Ah yeah true there is some overlap there thanks.

On 26 July 2017 at 14:19, T.J. Crowder <[email protected]>
wrote:

> I think you're talking about named parameters, or close enough anyway.
> Most recent discussion of named parameters (originally just "is there
> discussion of them?" but it went from there):
> https://esdiscuss.org/topic/named-paramters
>
> Others probably as well if you search back further in the archives and
> meeting notes.
>
> Note also overlap with parameter destructuring. It's a totally different
> thing, but can be used for some of the same use cases (long argument lists
> in particular).
>
> -- T.J. Crowder
>
> On Wed, Jul 26, 2017 at 2:09 PM, Gareth Heyes <
> [email protected]> wrote:
>
> Hi all
>>
>> I propose a new syntax for defining function argument hints. If you have
>> a lot of arguments in a function it can be difficult to remember which
>> argument is which. Using a hint allows you to easily see the argument
>> required and can prevent you from passing an incorrect argument.
>>
>> It would work like this:
>> ```javascript
>> function x(domNode, obj, someFlag) {
>> }
>>
>> //here are the argument hints
>> x(domNode:dom, obj: o, someFlag: true)
>> ```
>>
>> So here the js engine looks up the argument hint and compares it to the
>> function definition. If the hint does not match the function argument in
>> the definition then a exception is thrown.
>>
>> ```javascript
>> x(obj: o, someFlag: true) //error "obj" hint does not match "domNode"
>> hint.
>> ```
>>
>> The hint easily allow you to see what argument you are using without
>> having to look at the function definition and also prevent you passing an
>> incorrect argument.
>>
>> Cheers
>> Gareth
>>
>> _______________________________________________
>> es-discuss mailing list
>> [email protected]
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>>
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to