You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Finding an equivalent for this in Scala is complicated:
We could use a combination of Dynamic and whitebox macros but that would make it unusable in IDEs and not portable to dotty. The syntax would be ptr.field which is not the same but close enough.
If we try to use exactly the same syntax as in C ptr->field, it gets parsed as ptr.->(field), meaning that field has to be in scope, defined somewhere else. I don't really see how can one make it happen without some dark arcane magic (untyped macros?).
Workaround: (!ptr).field. This will load a whole struct and then extract a field from it.
The text was updated successfully, but these errors were encountered:
I've chatted with IntelliJ guys on Scala Days and they say it might be possible to add support for derivation of field types through an official extension mechanism they have. So using a whitebox macro for this seems to be the best way to go so far.
The eventual solution to this one landed in #472. We make structs anonymous by default and one can access fields via ptr._N where N is the index of the field.
Finding an equivalent for this in Scala is complicated:
Dynamic
and whitebox macros but that would make it unusable in IDEs and not portable to dotty. The syntax would beptr.field
which is not the same but close enough.ptr->field
, it gets parsed asptr.->(field)
, meaning thatfield
has to be in scope, defined somewhere else. I don't really see how can one make it happen without some dark arcane magic (untyped macros?).Workaround:
(!ptr).field
. This will load a whole struct and then extract a field from it.The text was updated successfully, but these errors were encountered: