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
It is possible to imagine that dispatching on an event is equivalent to a type check. In particular, if there is only one way of responding to an event, dispatching on the event is similar to a type cast. Thus, if is is possible to prove at compile time that the cast cannot fail, then the dispatch is unnecessary.
Moreover, if there is more than one way of responding to an event, then multiple types (of the different events) must be discriminated and again, dispatching might be considered to be a form of multi-way cast.
There may be senses in which dispatch is not 'reducible' to casting: the cost of performing a multi-way branch may be lower than multiple cast instructions -- especially if there is any form of subtyping involved.
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
-
It is possible to imagine that dispatching on an event is equivalent to a type check. In particular, if there is only one way of responding to an event, dispatching on the event is similar to a type cast. Thus, if is is possible to prove at compile time that the cast cannot fail, then the dispatch is unnecessary.
Moreover, if there is more than one way of responding to an event, then multiple types (of the different events) must be discriminated and again, dispatching might be considered to be a form of multi-way cast.
There may be senses in which dispatch is not 'reducible' to casting: the cost of performing a multi-way branch may be lower than multiple cast instructions -- especially if there is any form of subtyping involved.
Beta Was this translation helpful? Give feedback.
All reactions