P T Withington ptw at pobox.com
Thu Aug 14 11:53:50 PDT 2008

I'd like to relate an interesting data point from Dylan. We found that  
with generic functions, where you _have_ to specify parameter type for  
dispatch, and a decent type inferencer, you seldom needed to specify  
types anywhere else. When people specified types on locals, often the  
compiler would ignore the declaration because it already knew, or it  
would complain that it would have to insert a runtime check -- often  
because the programmer had underestimated the actual type.

On Aug 14, 2008, at 1:40 PM, Steven Johnson <stejohns at adobe.com> wrote:

> On 8/14/08 6:25 AM, "Neil Mix" <nmix at pandora.com> wrote:
>> It sounds like static type checking infers a certain
>> amount of "hard failure," i.e. you can't run this until you fix your
>> code.  That's not really what I'm voting for.  I just want it to be
>> possible, somehow, to catch simple type errors very early in the
>> development process, and then to run the same type annotated code
>> unchanged in the browser.
> Depends on what you mean by "hard failure". If we have a function like
>    // n must be a numeric type
>    function sqrt(n) { ... }
> then the ability to say
>    function sqrt(n:Number) { ... }
> only requires that n by convertible-to-Number at runtime. (If not,  
> ES4/AS3
> required that a TypeError be thrown.)
> This does make it possible to do some static type checking at  
> compile-time,
> of course (and the AS3 compiler can optionally do this).
> Personally, I like catching stupid mistakes of this sort as early as
> possible, so I tend to use type annotations everywhere I can when I  
> code in
> AS3. Your mileage may vary.
> _______________________________________________
> Es4-discuss mailing list
> Es4-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es4-discuss

More information about the Es-discuss mailing list