On Tue, Jul 1, 2014 at 3:20 PM, Geoffrey Irving <[email protected]> wrote:

> With the guard system you are proposing, is there anything about
> support for casts that isn't syntactic sugar on top of standard
> methods?  The guard features you mention seem to work equally well for
> non-cast methods.  If so, do we need sugar at all?


Yes, there is something that is not syntactic sugar. Though it turns out
that the "X as Y" expression *isn't* syntactic sugar, because a base
class/interface designer cannot enumerate all potential derived
class/interface types. So for the downcast case, what I'm really proposing
is that "x:X as Y" requires both "dynamictypeof(x) <=: Y" and also
"X.canDownCast() = true".

The net effect is that the language design no longer dictates whether
interface downcast is permitted. Control of that is restored into the hands
of the interface designer.


Jonathan
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to