Seems like this would lead to confusing operator precedence rules as well.
For example:
1<<foo>{}
... is perfectly valid JavaScript today (syntactically, anyway...), and is
equivalent to:
(1 << foo) > {}
... but I would assume that with the new syntax in place it would really be
interpreted as:
1 < function(foo) {}
... which is also valid JavaScript. Not that either of those examples
should ever occur in the real world, but in general I think they indicate
that `<` and `>` might be better left alone.
On Tue, Feb 11, 2014 at 3:53 PM, Till Schneidereit <
[email protected]> wrote:
> On Wed, Feb 12, 2014 at 9:39 AM, Tab Atkins Jr. <[email protected]>wrote:
>
>> On Tue, Feb 11, 2014 at 12:33 PM, biscotte a la crevette
>> <[email protected]> wrote:
>> > I would like to suggest an alternative function declaration syntax rule
>> :
>> > http://pastebin.mozilla.org/4258633
>> >
>> > That will lead to a way shorter function declaration (like Array [...]
>> > and Object {...} does ) :
>> >
>> > long story short : <...> will be equivalent to function(...)
>> >
>> > Which mean :
>> >
>> > var print = <name,age>{ //eq. to var print = function(name,age){...
>> > console.log("my name is " + name + " " + age + "y old.\n");
>> > }
>> >
>> > Human = <name,age=0>{
>> > this.age=age;
>> > this.name=age;
>> > this.toString=<>{
>> > return ...
>> > };
>> > }
>> >
>> > And so, will work with anonymous function declaration (which was my
>> main goal).
>> >
>> > my_list.map(<val>{return val<0?-val:val;});//return absolut-ified array
>> content
>>
>> Are you aware of the existing arrow functions? Using current ES6,
>> your example would be written as:
>>
>> my_list.map(val=>val<0?-val:val);
>>
>
> Also, there are short method declarations:
>
> var obj = {
> foo(bar, baz) {
> // stuffs
> }
> }
>
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
>
--
Jeremy Martin
661.312.3853
http://devsmash.com
@jmar777
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss