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

Reply via email to