Optional argument types

Alex Russell slightlyoff at google.com
Wed Sep 26 04:36:33 PDT 2012


On Tue, Sep 25, 2012 at 8:54 PM, Brendan Eich <brendan at mozilla.org> wrote:

> Andrea Giammarchi wrote:
>
>> then how about forgetting ducks and classes, going typeof without
>> implicit cast?
>>
>
> No.
>
> Why the desperation to get something -- *anything* -- even a half-baked
> idea based on broken old typeof? Where's the fire?
>
> Sorry, at this point in the thread I have to start pushing back!


I'm at the same point here.

I want both functions to be able to guard their arguments and declare their
returns. Hell, in early Traceur we event designed the Traits system so that
Traits can act like interfaces for this purpose.

But I'm not willing to rush this, nor give up on structural typing for no
good reason, nor endlessly revisit this. We can perhaps make progress on
this in ES7...but this thread probably isn't going to be the basis for that.

Regards


>
>  function doStuff(i:number, key:string, u:undefined, b:boolean,
>> fn:function):object {}
>>
>> where `null` will still be under the object type.
>>
>> Would this be a decent compromise or a pointless effort for no benefits?
>>
>
> The latter -- sorry, have to call it as I see it. You've heard from
> Andreas, Alex, and Allen too.
>
> Types are hard. This doesn't mean "no, never". But big brains are still
> researching the general topic, and btw what Dart has can't be called types
> according to the researchers and literature I trust.
>
>
> be
>
> ______________________________**_________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/**listinfo/es-discuss<https://mail.mozilla.org/listinfo/es-discuss>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120926/a3b98cc7/attachment.html>


More information about the es-discuss mailing list