Type Parameters are Completely Unnecessary
brendan at mozilla.org
Tue Mar 4 23:56:40 PST 2008
Last reply from me, this message veered away from personal attack --
for that, thanks.
On Mar 4, 2008, at 11:42 PM, Darryl wrote:
> Brendan Eich said:
> << This is clearly false. Type safety depends on
> specified language
> design (e.g. covariant argument subtyping in early
> Eiffel), not on
> implementation. But I am not sure we are speaking the
> same language,
> so I'll stop here. >>
> Ofcourse you have languages that mix the two. But as a
> programmer I don't _care_ about how you achieve it,
> and hence I don't think that it should impact syntax.
> The two _should_ be separate. If you want to do
> compile-time stuff to maintain type safety, go right
> ahead, but I don't see any reason why I should have to
> concern myself with this distinction.
The design is important, because without distinguished type
parameters, programmers may not know the meaning of C(T) -- is it a
call, or a parameterized type instantiation? This has nothing to do
with implementation issues.
Also, if you give up making type terms (in annotations and actual
type parameter lists, among other places) constants, then the type
checker may not be deterministic. If you make restrictions to gain
back determinism, the system may still have bad time complexity. Such
a type system can be and has been *implemented*, but it can take lots
of code, and it can run in exponential time. A standard way to cope
with the possibility of divergence is to set a watchdog timer.
This is not the optional strict mode users want.
If you make type terms purely runtime, and throw out strict mode
altogether, then what you propose (all in the name of syntax) can be
implemented. It's like the contract systems from PLT Scheme and other
such systems. We've considered it -- see the wiki.
But the benefit of strict mode is for finding bugs before code runs.
It's designed that way. Strict mode is not related to implementation
properties to do with performance.
So the design of type parameters is really is about language design,
not implementation. That should be obvious from the wiki pages I
More information about the Es4-discuss