Re: Cascade operator proposal — native fluent interfaces

2018-11-12 Thread kai zhu
quick PSA:

jslint recently (2018-09-27) added warning against "." delimited, per-line
method-chaining [1]

```javascript
/*jslint node*/
"use strict";
var str = "hello world";

// jslint - no warnings
console.log(
str.replace(
"hello",
"goodbye"
).replace(
"world",
"john"
).toUpperCase()
);

// jslint - warnings against "." delimited, per-line method-chaining
console.log(
str
// Unexpected space between 'str' and '.'.
.replace("hello", "goodbye")
// Unexpected space between ')' and '.'.
.replace("world", "john")
// Unexpected space between ')' and '.'.
.toUpperCase()
);
```

[1] jslint commit 2018-09-27 - warn against per-line method-chaining
https://github.com/douglascrockford/JSLint/commit/752c82d860ac14d35d492dc5c6ad0a0ed8227e76#diff-01d3d81a6eb6d82af3c377b55dc4fa28L4692

[image: Screen Shot 2018-11-13 at 11.06.26 AM.jpg]

On Tue, Nov 13, 2018 at 3:33 AM Michael Haufe 
wrote:

> It didn't survive the github migration AFAICT. There is no proposal listed
> on the repo.
>
>
> https://web.archive.org/web/20141214124428/http://wiki.ecmascript.org/doku.php?id=strawman:batch_assignment_operator
>
> https://esdiscuss.org/topic/batch-assignment-functions
>
>
> https://github.com/rwaldron/tc39-notes/blob/master/es6/2012-05/may-23.md#moustache
>
> On Mon, Nov 12, 2018 at 7:31 AM Andrea Giammarchi <
> andrea.giammar...@gmail.com> wrote:
>
>> I have a dejavu ... a similar proposal was rejected a while ago.
>>
>> Can't remember its name but it was like:
>>
>> ```js
>> foo.{
>>   a.b = c;
>>   d();
>> }
>> ```
>>
>> how is this different, if it's actually any different?
>>
>>
>> On Mon, Nov 12, 2018 at 2:23 PM T.J. Crowder <
>> tj.crow...@farsightsoftware.com> wrote:
>>
>>> On Sat, Nov 10, 2018 at 5:49 PM Timothy Johnson
>>>  wrote:
>>>
>>> It's **great** to see a proposal backed by an example implementation. :-)
>>>
>>> I suggest adding some explanation to the proposal about how your example
>>> knows the `..d()` applies to `foo` and not to `c`. From the Dart
>>> documentation, I'd *guess* (not being a Dart person) that it's because
>>> you'd need parens around the `c..d()` to force it to apply to that instead,
>>> but... More about the specific mechanics of that as it applies to JS would
>>> be useful.
>>>
>>> Probably also worth a one-liner that you're aware of and have allowed
>>> for how this relates to numeric literals (e.g.,
>>> `console.log(12..toString())`). I can see in your commit on the Babel fork
>>> that you have allowed for it, but for those who don't dig that deep...
>>>
>>> If this were in the language, I'd happily use it. I don't really feel
>>> the lack of it, though.
>>>
>>> -- T.J. Crowder
>>> ___
>>> 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
>
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: Cascade operator proposal — native fluent interfaces

2018-11-12 Thread Michael Haufe
It didn't survive the github migration AFAICT. There is no proposal listed
on the repo.

https://web.archive.org/web/20141214124428/http://wiki.ecmascript.org/doku.php?id=strawman:batch_assignment_operator

https://esdiscuss.org/topic/batch-assignment-functions

https://github.com/rwaldron/tc39-notes/blob/master/es6/2012-05/may-23.md#moustache

On Mon, Nov 12, 2018 at 7:31 AM Andrea Giammarchi <
andrea.giammar...@gmail.com> wrote:

> I have a dejavu ... a similar proposal was rejected a while ago.
>
> Can't remember its name but it was like:
>
> ```js
> foo.{
>   a.b = c;
>   d();
> }
> ```
>
> how is this different, if it's actually any different?
>
>
> On Mon, Nov 12, 2018 at 2:23 PM T.J. Crowder <
> tj.crow...@farsightsoftware.com> wrote:
>
>> On Sat, Nov 10, 2018 at 5:49 PM Timothy Johnson
>>  wrote:
>>
>> It's **great** to see a proposal backed by an example implementation. :-)
>>
>> I suggest adding some explanation to the proposal about how your example
>> knows the `..d()` applies to `foo` and not to `c`. From the Dart
>> documentation, I'd *guess* (not being a Dart person) that it's because
>> you'd need parens around the `c..d()` to force it to apply to that instead,
>> but... More about the specific mechanics of that as it applies to JS would
>> be useful.
>>
>> Probably also worth a one-liner that you're aware of and have allowed for
>> how this relates to numeric literals (e.g., `console.log(12..toString())`).
>> I can see in your commit on the Babel fork that you have allowed for it,
>> but for those who don't dig that deep...
>>
>> If this were in the language, I'd happily use it. I don't really feel the
>> lack of it, though.
>>
>> -- T.J. Crowder
>> ___
>> 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: Cascade operator proposal — native fluent interfaces

2018-11-12 Thread T.J. Crowder
On Sat, Nov 10, 2018 at 5:49 PM Timothy Johnson
 wrote:

It's **great** to see a proposal backed by an example implementation. :-)

I suggest adding some explanation to the proposal about how your example
knows the `..d()` applies to `foo` and not to `c`. From the Dart
documentation, I'd *guess* (not being a Dart person) that it's because
you'd need parens around the `c..d()` to force it to apply to that instead,
but... More about the specific mechanics of that as it applies to JS would
be useful.

Probably also worth a one-liner that you're aware of and have allowed for
how this relates to numeric literals (e.g., `console.log(12..toString())`).
I can see in your commit on the Babel fork that you have allowed for it,
but for those who don't dig that deep...

If this were in the language, I'd happily use it. I don't really feel the
lack of it, though.

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