typed variables and type checking
petermichaux at gmail.com
Tue Nov 11 10:54:39 PST 2008
I haven't seen, and hope I didn't just miss it, much talk recently
about types and type annotations for es-harmony.
What is the plan for when null is passed as an actual parameter to a
formal parameter with a type annotation which is not null? What if a
trailing parameter is not specified and the formal is left with an
Some languages allow these sort of things and the programmer has to do
null checks. This seems bad because if the type annotation is "Date"
then null should not be allowed to be assigned to the formal as null
doesn't have type Date.
Will there be a way to specify that multiple types are allowed in a
type annotation on a formal? Perhaps the programmer could explicitly
allow the null type this way?
If type checking is available it seems multi-methods could be
introduced by dispatching on actual parameters' types. Closure has an
interesting multi-method system which can dispatch on things other
than type. Has anyone thought about or looked into something like
More information about the Es-discuss