Consider javascript already support for default parameters, so maybe we can use the default parameter to specify the strong type.
Caitlin Potter
caitpotter88 at gmail.com
Mon May 18 18:39:13 UTC 2015
How do you distinguish between `function f(a = defaultComesFromEvaluatingSomeFunction(true))` from `function f(a = StrongType(true))`?
It’s ambiguous which one is meant, and that doesn’t really work.
> On May 18, 2015, at 2:35 PM, Emanuel Allen <emanuelallen at hotmail.com> wrote:
>
> I like to use what the language already have so if we can denote the type by constructor:
>
> Function foo(a=Number(64),b=String()){
> return b+a;
> }
>
> Sent from my iPhone
>
> On May 18, 2015, at 2:23 PM, Edwin Reynoso <eorroe at gmail.com <mailto:eorroe at gmail.com>> wrote:
>
>> Don't you just mean:
>>
>> ```
>> function addWithType(a=0, b=0) {
>> return int64(a) + int64(b);
>> }
>> ```
>>
>> On Mon, May 18, 2015 at 2:16 PM, Benjamin Gruenaum <benjamingr at gmail.com <mailto:benjamingr at gmail.com>> wrote:
>> What about non-default parameters?
>>
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org <mailto:es-discuss at mozilla.org>
>> https://mail.mozilla.org/listinfo/es-discuss <https://mail.mozilla.org/listinfo/es-discuss>
>>
>>
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org <mailto:es-discuss at mozilla.org>
>> https://mail.mozilla.org/listinfo/es-discuss <https://mail.mozilla.org/listinfo/es-discuss>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150518/e0bebf37/attachment.html>
More information about the es-discuss
mailing list