need some clarification on compile-time type vs. run-time type
P T Withington
ptw at pobox.com
Sun Nov 11 04:52:50 PST 2007
On 2007-11-11, at 00:57 EST, Brendan Eich wrote:
> There are questions about exactly what strict mode analyses might be
> mandated as normative if an implementation supports strict mode. This
> may be clearer to Graydon and Cormac than to me, so I'd welcome their
> comments. For example:
>
> function g(a_not_null: T!) ...
>
> function f(a: T) {
> if (a !== null)
> g(a); // no cast required?
> }
IMO, mandating that level of analysis violates the spirit of the goal
of permitting simple compilers. You should use `type switch` if you
want to avoid the cast (and guarantee no redundant runtime overhead).
More information about the Es4-discuss
mailing list