Re: Pseudo headless arrows

2016-04-22 Thread Joris van der Wel
Yes, that is still how mocha does things. Mocha is not the best example
though, because it is not compatible with arrow functions. Mocha uses
`this` to expose extra functions to your test case. (I always use a wrapper
around mocha to avoid these issues)

Subject: Re: Pseudo headless arrows
> @John: Good point.
> IIRC, Mocha was (is?) one of such test frameworks that inspect the
> function's `length` property in order to determine whether the author
> intends the test to be run asynchronously (i.e. the first argument receives
> a function that must be called when the test is done).
> Whether that is a good practice is questionable, however.
>
> /fm
>
> On Thu, Apr 21, 2016 at 7:44 PM, John Lenz <concavel...@gmail.com> wrote:
>
>> _=>{} is a function that takes one param and is not equivalent to
>> ()=>{}.  Some test frameworks inspect the function and care about the
>> difference.
>> On Apr 21, 2016 3:34 PM, "Fabrício Matté" <ultco...@gmail.com> wrote:
>>
>> The `==>` token would look like a new operator, which developers would
>> have to look up in order to know exactly what it does. It is more confusing
>> than helpful, IMHO.
>> Also `==>x` has the same length as `_=>x`, the latter not introducing any
>> new syntax (although it does employ an ugly unused identifier).
>>
>> By the way, this may be of interest to you: Headless Arrow Functions
>> proposal <http://bterlson.github.io/headless-arrows/>.
>>
>> /fm
>>
>> On Thu, Apr 21, 2016 at 3:48 PM, Peter van der Zee <e...@qfox.nl> wrote:
>>
>>> 
>>>
>>> There are two ways of writing argument-less arrows;
>>>
>>> () => x;
>>> _ => x;
>>>
>>> (Where `_` can be any identifier, of course.) I understand why we
>>> can't drop the head entirely so if we're forced to type anything at
>>> all, anyways, why not at least make it simpler by pressing two
>>> different keys instead of three/four:
>>>
>>> ==> x;
>>>
>>> I don't believe this leads to syntactical problems anywhere, not even
>>> with arrow functions themselves and it's future proof for at least the
>>> cases I'm aware of.
>>>
>>> It's a minor addition but I think it's much nicer than either of the
>>> two alternatives we currently have, which lead to a lot of
>>> inconsistencies (it's spaces and tabs all over again).
>>>
>>> Semantics are the same otherwise as `() => x` would be.
>>>
>>> - peter
>>> ___
>>> es-discuss mailing list
>>> es-discuss@mozilla.org
>>> https://mail.mozilla.org/listinfo/es-discuss
>>>
>>
>>
>> ___
>> es-discuss mailing list
>> es-discuss@mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>>
>
>
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: Pseudo headless arrows

2016-04-22 Thread /#!/JoePea
I like that Headless Arrow Function proposal
(http://bterlson.github.io/headless-arrows).

```js
doSomethingAsync(=> console.log('done'))
```

On Thu, Apr 21, 2016 at 5:02 PM, Michael Theriot
 wrote:
> Three equals used outside of strict equality might take some getting used to
> `var fn ===> x`
>
> On Thu, Apr 21, 2016 at 1:48 PM, Peter van der Zee  wrote:
>>
>> 
>>
>> There are two ways of writing argument-less arrows;
>>
>> () => x;
>> _ => x;
>>
>> (Where `_` can be any identifier, of course.) I understand why we
>> can't drop the head entirely so if we're forced to type anything at
>> all, anyways, why not at least make it simpler by pressing two
>> different keys instead of three/four:
>>
>> ==> x;
>>
>> I don't believe this leads to syntactical problems anywhere, not even
>> with arrow functions themselves and it's future proof for at least the
>> cases I'm aware of.
>>
>> It's a minor addition but I think it's much nicer than either of the
>> two alternatives we currently have, which lead to a lot of
>> inconsistencies (it's spaces and tabs all over again).
>>
>> Semantics are the same otherwise as `() => x` would be.
>>
>> - peter
>> ___
>> es-discuss mailing list
>> es-discuss@mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>
>
>
> ___
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: Pseudo headless arrows

2016-04-21 Thread Michael Theriot
Three equals used outside of strict equality might take some getting used
to `var fn ===> x`

On Thu, Apr 21, 2016 at 1:48 PM, Peter van der Zee  wrote:

> 
>
> There are two ways of writing argument-less arrows;
>
> () => x;
> _ => x;
>
> (Where `_` can be any identifier, of course.) I understand why we
> can't drop the head entirely so if we're forced to type anything at
> all, anyways, why not at least make it simpler by pressing two
> different keys instead of three/four:
>
> ==> x;
>
> I don't believe this leads to syntactical problems anywhere, not even
> with arrow functions themselves and it's future proof for at least the
> cases I'm aware of.
>
> It's a minor addition but I think it's much nicer than either of the
> two alternatives we currently have, which lead to a lot of
> inconsistencies (it's spaces and tabs all over again).
>
> Semantics are the same otherwise as `() => x` would be.
>
> - peter
> ___
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: Pseudo headless arrows

2016-04-21 Thread Fabrício Matté
@John: Good point.
IIRC, Mocha was (is?) one of such test frameworks that inspect the
function's `length` property in order to determine whether the author
intends the test to be run asynchronously (i.e. the first argument receives
a function that must be called when the test is done).
Whether that is a good practice is questionable, however.

/fm

On Thu, Apr 21, 2016 at 7:44 PM, John Lenz  wrote:

> _=>{} is a function that takes one param and is not equivalent to ()=>{}.
> Some test frameworks inspect the function and care about the difference.
> On Apr 21, 2016 3:34 PM, "Fabrício Matté"  wrote:
>
> The `==>` token would look like a new operator, which developers would
> have to look up in order to know exactly what it does. It is more confusing
> than helpful, IMHO.
> Also `==>x` has the same length as `_=>x`, the latter not introducing any
> new syntax (although it does employ an ugly unused identifier).
>
> By the way, this may be of interest to you: Headless Arrow Functions
> proposal .
>
> /fm
>
> On Thu, Apr 21, 2016 at 3:48 PM, Peter van der Zee  wrote:
>
>> 
>>
>> There are two ways of writing argument-less arrows;
>>
>> () => x;
>> _ => x;
>>
>> (Where `_` can be any identifier, of course.) I understand why we
>> can't drop the head entirely so if we're forced to type anything at
>> all, anyways, why not at least make it simpler by pressing two
>> different keys instead of three/four:
>>
>> ==> x;
>>
>> I don't believe this leads to syntactical problems anywhere, not even
>> with arrow functions themselves and it's future proof for at least the
>> cases I'm aware of.
>>
>> It's a minor addition but I think it's much nicer than either of the
>> two alternatives we currently have, which lead to a lot of
>> inconsistencies (it's spaces and tabs all over again).
>>
>> Semantics are the same otherwise as `() => x` would be.
>>
>> - peter
>> ___
>> es-discuss mailing list
>> es-discuss@mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>
>
> ___
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: Pseudo headless arrows

2016-04-21 Thread John Lenz
_=>{} is a function that takes one param and is not equivalent to ()=>{}.
Some test frameworks inspect the function and care about the difference.
On Apr 21, 2016 3:34 PM, "Fabrício Matté"  wrote:

The `==>` token would look like a new operator, which developers would have
to look up in order to know exactly what it does. It is more confusing than
helpful, IMHO.
Also `==>x` has the same length as `_=>x`, the latter not introducing any
new syntax (although it does employ an ugly unused identifier).

By the way, this may be of interest to you: Headless Arrow Functions
proposal .

/fm

On Thu, Apr 21, 2016 at 3:48 PM, Peter van der Zee  wrote:

> 
>
> There are two ways of writing argument-less arrows;
>
> () => x;
> _ => x;
>
> (Where `_` can be any identifier, of course.) I understand why we
> can't drop the head entirely so if we're forced to type anything at
> all, anyways, why not at least make it simpler by pressing two
> different keys instead of three/four:
>
> ==> x;
>
> I don't believe this leads to syntactical problems anywhere, not even
> with arrow functions themselves and it's future proof for at least the
> cases I'm aware of.
>
> It's a minor addition but I think it's much nicer than either of the
> two alternatives we currently have, which lead to a lot of
> inconsistencies (it's spaces and tabs all over again).
>
> Semantics are the same otherwise as `() => x` would be.
>
> - peter
> ___
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>


___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: Pseudo headless arrows

2016-04-21 Thread Fabrício Matté
The `==>` token would look like a new operator, which developers would have
to look up in order to know exactly what it does. It is more confusing than
helpful, IMHO.
Also `==>x` has the same length as `_=>x`, the latter not introducing any
new syntax (although it does employ an ugly unused identifier).

By the way, this may be of interest to you: Headless Arrow Functions
proposal .

/fm

On Thu, Apr 21, 2016 at 3:48 PM, Peter van der Zee  wrote:

> 
>
> There are two ways of writing argument-less arrows;
>
> () => x;
> _ => x;
>
> (Where `_` can be any identifier, of course.) I understand why we
> can't drop the head entirely so if we're forced to type anything at
> all, anyways, why not at least make it simpler by pressing two
> different keys instead of three/four:
>
> ==> x;
>
> I don't believe this leads to syntactical problems anywhere, not even
> with arrow functions themselves and it's future proof for at least the
> cases I'm aware of.
>
> It's a minor addition but I think it's much nicer than either of the
> two alternatives we currently have, which lead to a lot of
> inconsistencies (it's spaces and tabs all over again).
>
> Semantics are the same otherwise as `() => x` would be.
>
> - peter
> ___
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Pseudo headless arrows

2016-04-21 Thread Peter van der Zee


There are two ways of writing argument-less arrows;

() => x;
_ => x;

(Where `_` can be any identifier, of course.) I understand why we
can't drop the head entirely so if we're forced to type anything at
all, anyways, why not at least make it simpler by pressing two
different keys instead of three/four:

==> x;

I don't believe this leads to syntactical problems anywhere, not even
with arrow functions themselves and it's future proof for at least the
cases I'm aware of.

It's a minor addition but I think it's much nicer than either of the
two alternatives we currently have, which lead to a lot of
inconsistencies (it's spaces and tabs all over again).

Semantics are the same otherwise as `() => x` would be.

- peter
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss