Close review of Language Overview whitepaper
cormac at ucsc.edu
Sat Nov 17 20:08:04 PST 2007
Thanks for your feedback! Two additional comments...
> "Any": The spec explains vaguely that the "any" type is not identical
> to the union (null, undefined, Object). How is it different? Is the
> difference observable to ES4 programs or is it purely a matter
> internal to the spec (in which case the difference is not relevant)?
The essential difference is in strict mode, where a variable of type
"Any" can be passed to a context expecting a more specific type (say
int), and "Any" gets implicitly downcast. In contrast, passing "(null,
undefined, Object)" or even "Object" to somewhere expecting an int
would be a verify-time error.
> "switch type" statement: I guess this beats switching on typeof, but
> is it really significantly better than a series of "if" statements
> using the "is" operator?
Well, you'd need a bunch of cast operations too, at least in strict
mode, and it gets a little ugly/verbose.
More information about the Es4-discuss