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
Regular TypeScript does not use types for directing the compilation. The DeviceScript compiler currently does, most crucially when compiling access to roles (they are compiled down to command/report codes, binary layouts etc). This means that role members will not work when the role is casted to any (or a generic type, or some interface).
I think at this point we can either:
decide it's fine to use types for compilation; this would lead to various departures from EcmaScript (ES) semantics - I think at that point we should settle for only superficial similarity with TypeScript
compile the role spec to a special object prototype (and tree-shake it; however the compressed spec wouldn't be very big anyways (for every packet just name plus a few bytes))
We are unlikely to ever reach ES-whatever full compatibility due to resource constraints. Thus there will always be things that are either missing or don't quite work the same way as in ES.
In any case the point should be to cut down surprise factor:
if something compiles then it should not behave "grossly wrong", that is clearly (to a "typical programmer" not a programming language lawyer) different from ES and also clearly wrong (eg., true == "1" - who cares!)
we'll probably need a few well-documented exception to the above (prototype lookup via indexing comes to mind)
if something doesn't compile but gives a meaningful error message then it's OK even if surprising
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Regular TypeScript does not use types for directing the compilation. The DeviceScript compiler currently does, most crucially when compiling access to roles (they are compiled down to command/report codes, binary layouts etc). This means that role members will not work when the role is casted to
any
(or a generic type, or some interface).I think at this point we can either:
We are unlikely to ever reach ES-whatever full compatibility due to resource constraints. Thus there will always be things that are either missing or don't quite work the same way as in ES.
In any case the point should be to cut down surprise factor:
true == "1"
- who cares!)Beta Was this translation helpful? Give feedback.
All reactions