please add x .= f()
-1 Please no :)
-1 Please no :) > On Aug 11, 2015, at 2:40 AM, Soni L. <fakedme+es at gmail.com> wrote: > > x .= f() should be syntax sugar for x = x.f() > > x .= f().g().h() should be x = x.f().g().h() > > -- > Disclaimer: these emails are public and can be accessed from <TODO: get a non-DHCP IP and put it here>. If you do not agree with this, DO NOT REPLY. > > _______________________________________________ > es-discuss mailing list > es-discuss at mozilla.org > https://mail.mozilla.org/listinfo/es-discuss
Hello,
x .= f() should be syntax sugar for x = x.f()
x .= f().g().h() should be x = x.f().g().h()
+1! I've made some weeks ago a prototype of this in sweet.js: fflorent/member-access-assignment
Except that the syntax is rather =. (I have probably been influenced by the CoffeeScript's existential operator). The reverse looks fine to me too.
-1 Please no :)
Why?
Florent
Hello, > x .= f() should be syntax sugar for x = x.f() > > x .= f().g().h() should be x = x.f().g().h() +1! I've made some weeks ago a prototype of this in sweet.js: https://github.com/fflorent/member-access-assignment Except that the syntax is rather =. (I have probably been influenced by the CoffeeScript's existential operator). The reverse looks fine to me too. > -1 Please no :) Why? Florent
I want to +1 the -1, but I'll add a
Please no
instead as well.
I want to +1 the -1, but I'll add a Please no instead as well. On Mon, Aug 10, 2015 at 6:42 PM, Bucaran <jbucaran at me.com> wrote: > -1 Please no :) > > > On Aug 11, 2015, at 2:40 AM, Soni L. <fakedme+es at gmail.com> wrote: > > > > x .= f() should be syntax sugar for x = x.f() > > > > x .= f().g().h() should be x = x.f().g().h() > > > > -- > > Disclaimer: these emails are public and can be accessed from <TODO: get > a non-DHCP IP and put it here>. If you do not agree with this, DO NOT REPLY. > > > > _______________________________________________ > > es-discuss mailing list > > es-discuss at mozilla.org > > https://mail.mozilla.org/listinfo/es-discuss > > _______________________________________________ > es-discuss mailing list > es-discuss at mozilla.org > https://mail.mozilla.org/listinfo/es-discuss > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150810/9baa5390/attachment.html>
Do not send "Please add" messages with two-line, half-baked sketches of extensions to the language. That's just injecting noise with very little signal.
The "-1" you received will be the answer if pressed from everyone on TC39, I would bet real money. Syntax is expensive, adding it for little semantic gain and some downside user-confusion risk (plus a small complexity tax hike for the language in full) is never the right answer.
That you can scratch this itch (and many others like it) via sweet.js does not argue for incorporating any such =. or .= operator into the core language. Analyze developer patterns and nearby languages for better candidate extensions that solve more serious usability or greater issues.
Do not send "Please add" messages with two-line, half-baked sketches of extensions to the language. That's just injecting noise with very little signal. The "-1" you received will be the answer if pressed from everyone on TC39, I would bet real money. Syntax is expensive, adding it for little semantic gain and some downside user-confusion risk (plus a small complexity tax hike for the language in full) is never the right answer. That you can scratch this itch (and many others like it) via sweet.js does not argue for incorporating any such =. or .= operator into the core language. Analyze developer patterns and nearby languages for better candidate extensions that solve more serious usability or greater issues. /be Florent FAYOLLE wrote: > Hello, >> x .= f() should be syntax sugar for x = x.f() >> >> x .= f().g().h() should be x = x.f().g().h() > > +1! I've made some weeks ago a prototype of this in sweet.js: > https://github.com/fflorent/member-access-assignment > > Except that the syntax is rather =. (I have probably been influenced > by the CoffeeScript's existential operator). The reverse looks fine to > me too. > >> -1 Please no :) > Why? > > Florent > _______________________________________________ > es-discuss mailing list > es-discuss at mozilla.org > https://mail.mozilla.org/listinfo/es-discuss >
Please no, while i can see how logically it's derived from a = a + 1
a = a.f()
a .= f()
seems like a bad idea
i can hardly see the dot why would i replace the object from which i'm calling the method in most cases looks inefficient
Please no, while i can see how logically it's derived from a = a + 1 a = a.f() a .= f() seems like a bad idea i can hardly see the dot why would i replace the object from which i'm calling the method in most cases looks inefficient On Mon, Aug 10, 2015 at 2:07 PM, Brendan Eich <brendan at mozilla.org> wrote: > Do not send "Please add" messages with two-line, half-baked sketches of > extensions to the language. That's just injecting noise with very little > signal. > > The "-1" you received will be the answer if pressed from everyone on TC39, > I would bet real money. Syntax is expensive, adding it for little semantic > gain and some downside user-confusion risk (plus a small complexity tax > hike for the language in full) is never the right answer. > > That you can scratch this itch (and many others like it) via sweet.js does > not argue for incorporating any such =. or .= operator into the core > language. Analyze developer patterns and nearby languages for better > candidate extensions that solve more serious usability or greater issues. > > /be > > > Florent FAYOLLE wrote: > >> Hello, >> >>> x .= f() should be syntax sugar for x = x.f() >>> >>> x .= f().g().h() should be x = x.f().g().h() >>> >> >> +1! I've made some weeks ago a prototype of this in sweet.js: >> https://github.com/fflorent/member-access-assignment >> >> Except that the syntax is rather =. (I have probably been influenced by >> the CoffeeScript's existential operator). The reverse looks fine to me too. >> >> -1 Please no :) >>> >> Why? >> >> Florent >> _______________________________________________ >> es-discuss mailing list >> es-discuss at mozilla.org >> https://mail.mozilla.org/listinfo/es-discuss >> >> _______________________________________________ > es-discuss mailing list > es-discuss at mozilla.org > https://mail.mozilla.org/listinfo/es-discuss > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150810/60a73ccd/attachment.html>
Not sure if trolling...
Not sure if trolling... On Monday, 10 August 2015, Soni L. <fakedme+es at gmail.com> wrote: > x .= f() should be syntax sugar for x = x.f() > > x .= f().g().h() should be x = x.f().g().h() > > -- > Disclaimer: these emails are public and can be accessed from <TODO: get a > non-DHCP IP and put it here>. If you do not agree with this, DO NOT REPLY. > > _______________________________________________ > es-discuss mailing list > es-discuss at mozilla.org > https://mail.mozilla.org/listinfo/es-discuss > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150810/0c8b3594/attachment.html>
not only it's badly readable and reminds me the PHP string concatenation, but it promotes different type assignment which is a performance, and virtually strongly typed, anti-pattern.
I think Brendan said already it all, the proposal is badly described, and it solve pretty much nothing in the real world.
Probably we can just move on and ignore the list of -1 we'll all put in? ;-)
Best
not only it's badly readable and reminds me the PHP string concatenation, but it promotes different type assignment which is a performance, and virtually strongly typed, anti-pattern. I think Brendan said already it all, the proposal is badly described, and it solve pretty much nothing in the real world. Probably we can just move on and ignore the list of -1 we'll all put in? ;-) Best Regards On Mon, Aug 10, 2015 at 8:46 PM, <myemailum14 at gmail.com> wrote: > Please no, while i can see how logically it's derived from a = a + 1 > > a = a.f() > > a .= f() > > seems like a bad idea > > i can hardly see the dot > why would i replace the object from which i'm calling the method in most > cases looks inefficient > > > On Mon, Aug 10, 2015 at 2:07 PM, Brendan Eich <brendan at mozilla.org> wrote: > >> Do not send "Please add" messages with two-line, half-baked sketches of >> extensions to the language. That's just injecting noise with very little >> signal. >> >> The "-1" you received will be the answer if pressed from everyone on >> TC39, I would bet real money. Syntax is expensive, adding it for little >> semantic gain and some downside user-confusion risk (plus a small >> complexity tax hike for the language in full) is never the right answer. >> >> That you can scratch this itch (and many others like it) via sweet.js >> does not argue for incorporating any such =. or .= operator into the core >> language. Analyze developer patterns and nearby languages for better >> candidate extensions that solve more serious usability or greater issues. >> >> /be >> >> >> Florent FAYOLLE wrote: >> >>> Hello, >>> >>>> x .= f() should be syntax sugar for x = x.f() >>>> >>>> x .= f().g().h() should be x = x.f().g().h() >>>> >>> >>> +1! I've made some weeks ago a prototype of this in sweet.js: >>> https://github.com/fflorent/member-access-assignment >>> >>> Except that the syntax is rather =. (I have probably been influenced by >>> the CoffeeScript's existential operator). The reverse looks fine to me too. >>> >>> -1 Please no :) >>>> >>> Why? >>> >>> Florent >>> _______________________________________________ >>> es-discuss mailing list >>> es-discuss at mozilla.org >>> https://mail.mozilla.org/listinfo/es-discuss >>> >>> _______________________________________________ >> es-discuss mailing list >> es-discuss at mozilla.org >> https://mail.mozilla.org/listinfo/es-discuss >> > > > _______________________________________________ > es-discuss mailing list > es-discuss at mozilla.org > https://mail.mozilla.org/listinfo/es-discuss > > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150810/5e555b04/attachment-0001.html>
had same feeling just reading the initial email ... fakedme+es@ ...
had same feeling just reading the initial email ... fakedme+es@ ... On Mon, Aug 10, 2015 at 8:50 PM, Alexander Jones <alex at weej.com> wrote: > Not sure if trolling... > > On Monday, 10 August 2015, Soni L. <fakedme+es at gmail.com> wrote: > >> x .= f() should be syntax sugar for x = x.f() >> >> x .= f().g().h() should be x = x.f().g().h() >> >> -- >> Disclaimer: these emails are public and can be accessed from <TODO: get a >> non-DHCP IP and put it here>. If you do not agree with this, DO NOT REPLY. >> >> _______________________________________________ >> es-discuss mailing list >> es-discuss at mozilla.org >> https://mail.mozilla.org/listinfo/es-discuss >> > > _______________________________________________ > es-discuss mailing list > es-discuss at mozilla.org > https://mail.mozilla.org/listinfo/es-discuss > > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150810/ab8ccf63/attachment.html>
Welp I keep replying this wrong (how should I configure my email client?)
It /could/ in theory be used like this:
function path(s) { if (s.charAt(0) == '/') { s.=substring(1); } // your stuff here }
Welp I keep replying this wrong (how should I configure my email client?) ------------------------------------------------------------------------- It /could/ in theory be used like this: function path(s) { if (s.charAt(0) == '/') { s.=substring(1); } // your stuff here } On 10/08/15 04:50 PM, Andrea Giammarchi wrote: > not only it's badly readable and reminds me the PHP string concatenation, > but it promotes different type assignment which is a performance, and > virtually strongly typed, anti-pattern. > > I think Brendan said already it all, the proposal is badly described, > and it solve pretty much nothing in the real world. > > Probably we can just move on and ignore the list of -1 we'll all put > in? ;-) > > Best Regards > > On Mon, Aug 10, 2015 at 8:46 PM, <myemailum14 at gmail.com > <mailto:myemailum14 at gmail.com>> wrote: > > Please no, while i can see how logically it's derived from a = a + 1 > > a = a.f() > > a .= f() > > seems like a bad idea > > i can hardly see the dot > why would i replace the object from which i'm calling the method > in most cases looks inefficient > > > On Mon, Aug 10, 2015 at 2:07 PM, Brendan Eich <brendan at mozilla.org > <mailto:brendan at mozilla.org>> wrote: > > Do not send "Please add" messages with two-line, half-baked > sketches of extensions to the language. That's just injecting > noise with very little signal. > > The "-1" you received will be the answer if pressed from > everyone on TC39, I would bet real money. Syntax is expensive, > adding it for little semantic gain and some downside > user-confusion risk (plus a small complexity tax hike for the > language in full) is never the right answer. > > That you can scratch this itch (and many others like it) via > sweet.js does not argue for incorporating any such =. or .= > operator into the core language. Analyze developer patterns > and nearby languages for better candidate extensions that > solve more serious usability or greater issues. > > /be > > > Florent FAYOLLE wrote: > > Hello, > > x .= f() should be syntax sugar for x = x.f() > > x .= f().g().h() should be x = x.f().g().h() > > > +1! I've made some weeks ago a prototype of this in sweet.js: > https://github.com/fflorent/member-access-assignment > > Except that the syntax is rather =. (I have probably been > influenced by the CoffeeScript's existential operator). > The reverse looks fine to me too. > > -1 Please no :) > > Why? > > Florent > _______________________________________________ > es-discuss mailing list > es-discuss at mozilla.org <mailto:es-discuss at mozilla.org> > https://mail.mozilla.org/listinfo/es-discuss > > _______________________________________________ > es-discuss mailing list > es-discuss at mozilla.org <mailto:es-discuss at mozilla.org> > https://mail.mozilla.org/listinfo/es-discuss > > > > _______________________________________________ > es-discuss mailing list > es-discuss at mozilla.org <mailto:es-discuss at mozilla.org> > https://mail.mozilla.org/listinfo/es-discuss > > > > > _______________________________________________ > es-discuss mailing list > es-discuss at mozilla.org > https://mail.mozilla.org/listinfo/es-discuss -- Disclaimer: these emails are public and can be accessed from <TODO: get a non-DHCP IP and put it here>. If you do not agree with this, DO NOT REPLY. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150810/498d1955/attachment.html>
For that, you'd do if (s.charAt(0) === '/') { s = s.slice(1); }
- which
is only slightly more verbose than your example, without the burden of new
syntax.
For that, you'd do `if (s.charAt(0) === '/') { s = s.slice(1); }` - which is only slightly more verbose than your example, without the burden of new syntax. On Mon, Aug 10, 2015 at 1:57 PM, Soni L. <fakedme+es at gmail.com> wrote: > Welp I keep replying this wrong (how should I configure my email client?) > ------------------------------------------------------------------------- > > It /could/ in theory be used like this: > > function path(s) { > if (s.charAt(0) == '/') { s.=substring(1); } > // your stuff here > } > > > On 10/08/15 04:50 PM, Andrea Giammarchi wrote: > > not only it's badly readable and reminds me the PHP string concatenation, > but it promotes different type assignment which is a performance, and > virtually strongly typed, anti-pattern. > > I think Brendan said already it all, the proposal is badly described, and > it solve pretty much nothing in the real world. > > Probably we can just move on and ignore the list of -1 we'll all put in? > ;-) > > Best Regards > > On Mon, Aug 10, 2015 at 8:46 PM, <myemailum14 at gmail.com> wrote: > >> Please no, while i can see how logically it's derived from a = a + 1 >> >> a = a.f() >> >> a .= f() >> >> seems like a bad idea >> >> i can hardly see the dot >> why would i replace the object from which i'm calling the method in most >> cases looks inefficient >> >> >> On Mon, Aug 10, 2015 at 2:07 PM, Brendan Eich < <brendan at mozilla.org> >> brendan at mozilla.org> wrote: >> >>> Do not send "Please add" messages with two-line, half-baked sketches of >>> extensions to the language. That's just injecting noise with very little >>> signal. >>> >>> The "-1" you received will be the answer if pressed from everyone on >>> TC39, I would bet real money. Syntax is expensive, adding it for little >>> semantic gain and some downside user-confusion risk (plus a small >>> complexity tax hike for the language in full) is never the right answer. >>> >>> That you can scratch this itch (and many others like it) via sweet.js >>> does not argue for incorporating any such =. or .= operator into the core >>> language. Analyze developer patterns and nearby languages for better >>> candidate extensions that solve more serious usability or greater issues. >>> >>> /be >>> >>> >>> Florent FAYOLLE wrote: >>> >>>> Hello, >>>> >>>>> x .= f() should be syntax sugar for x = x.f() >>>>> >>>>> x .= f().g().h() should be x = x.f().g().h() >>>>> >>>> >>>> +1! I've made some weeks ago a prototype of this in sweet.js: >>>> https://github.com/fflorent/member-access-assignment >>>> >>>> Except that the syntax is rather =. (I have probably been influenced by >>>> the CoffeeScript's existential operator). The reverse looks fine to me too. >>>> >>>> -1 Please no :) >>>>> >>>> Why? >>>> >>>> Florent >>>> _______________________________________________ >>>> es-discuss mailing list >>>> es-discuss at mozilla.org >>>> https://mail.mozilla.org/listinfo/es-discuss >>>> >>>> _______________________________________________ >>> es-discuss mailing list >>> es-discuss at mozilla.org >>> https://mail.mozilla.org/listinfo/es-discuss >>> >> >> >> _______________________________________________ >> es-discuss mailing list >> es-discuss at mozilla.org >> https://mail.mozilla.org/listinfo/es-discuss >> >> > > > _______________________________________________ > es-discuss mailing listes-discuss at mozilla.orghttps://mail.mozilla.org/listinfo/es-discuss > > > -- > Disclaimer: these emails are public and can be accessed from <TODO: get a non-DHCP IP and put it here>. If you do not agree with this, DO NOT REPLY. > > > _______________________________________________ > es-discuss mailing list > es-discuss at mozilla.org > https://mail.mozilla.org/listinfo/es-discuss > > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150810/15c1fadd/attachment.html>
That's not really the point.
The suggestion is this instead:
if (s[0] === '/') s = s.slice(1);
if (s[0] === '/') s .= slice(1);
This already exists in CoffeeScript and most derivatives/dialects.
s .= slice 1 if s[0] is '/'
Don't know of any other languages that have an equivalent, though.
That's not really the point. The suggestion is this instead: ```js if (s[0] === '/') s = s.slice(1); if (s[0] === '/') s .= slice(1); ``` This already exists in CoffeeScript and most derivatives/dialects. ```coffee s .= slice 1 if s[0] is '/' ``` Don't know of any other languages that have an equivalent, though. On Mon, Aug 10, 2015, 19:31 Jordan Harband <ljharb at gmail.com> wrote: > For that, you'd do `if (s.charAt(0) === '/') { s = s.slice(1); }` - which > is only slightly more verbose than your example, without the burden of new > syntax. > > On Mon, Aug 10, 2015 at 1:57 PM, Soni L. <fakedme+es at gmail.com> wrote: > >> Welp I keep replying this wrong (how should I configure my email client?) >> ------------------------------------------------------------------------- >> >> It /could/ in theory be used like this: >> >> function path(s) { >> if (s.charAt(0) == '/') { s.=substring(1); } >> // your stuff here >> } >> >> >> On 10/08/15 04:50 PM, Andrea Giammarchi wrote: >> >> not only it's badly readable and reminds me the PHP string concatenation, >> but it promotes different type assignment which is a performance, and >> virtually strongly typed, anti-pattern. >> >> I think Brendan said already it all, the proposal is badly described, and >> it solve pretty much nothing in the real world. >> >> Probably we can just move on and ignore the list of -1 we'll all put in? >> ;-) >> >> Best Regards >> >> On Mon, Aug 10, 2015 at 8:46 PM, <myemailum14 at gmail.com> wrote: >> >>> Please no, while i can see how logically it's derived from a = a + 1 >>> >>> a = a.f() >>> >>> a .= f() >>> >>> seems like a bad idea >>> >>> i can hardly see the dot >>> why would i replace the object from which i'm calling the method in most >>> cases looks inefficient >>> >>> >>> On Mon, Aug 10, 2015 at 2:07 PM, Brendan Eich < <brendan at mozilla.org> >>> brendan at mozilla.org> wrote: >>> >>>> Do not send "Please add" messages with two-line, half-baked sketches of >>>> extensions to the language. That's just injecting noise with very little >>>> signal. >>>> >>>> The "-1" you received will be the answer if pressed from everyone on >>>> TC39, I would bet real money. Syntax is expensive, adding it for little >>>> semantic gain and some downside user-confusion risk (plus a small >>>> complexity tax hike for the language in full) is never the right answer. >>>> >>>> That you can scratch this itch (and many others like it) via sweet.js >>>> does not argue for incorporating any such =. or .= operator into the core >>>> language. Analyze developer patterns and nearby languages for better >>>> candidate extensions that solve more serious usability or greater issues. >>>> >>>> /be >>>> >>>> >>>> Florent FAYOLLE wrote: >>>> >>>>> Hello, >>>>> >>>>>> x .= f() should be syntax sugar for x = x.f() >>>>>> >>>>>> x .= f().g().h() should be x = x.f().g().h() >>>>>> >>>>> >>>>> +1! I've made some weeks ago a prototype of this in sweet.js: >>>>> https://github.com/fflorent/member-access-assignment >>>>> >>>>> Except that the syntax is rather =. (I have probably been influenced >>>>> by the CoffeeScript's existential operator). The reverse looks fine to me >>>>> too. >>>>> >>>>> -1 Please no :) >>>>>> >>>>> Why? >>>>> >>>>> Florent >>>>> _______________________________________________ >>>>> es-discuss mailing list >>>>> es-discuss at mozilla.org >>>>> https://mail.mozilla.org/listinfo/es-discuss >>>>> >>>>> _______________________________________________ >>>> es-discuss mailing list >>>> es-discuss at mozilla.org >>>> https://mail.mozilla.org/listinfo/es-discuss >>>> >>> >>> >>> _______________________________________________ >>> es-discuss mailing list >>> es-discuss at mozilla.org >>> https://mail.mozilla.org/listinfo/es-discuss >>> >>> >> >> >> _______________________________________________ >> es-discuss mailing listes-discuss at mozilla.orghttps://mail.mozilla.org/listinfo/es-discuss >> >> >> -- >> Disclaimer: these emails are public and can be accessed from <TODO: get a non-DHCP IP and put it here>. If you do not agree with this, DO NOT REPLY. >> >> >> _______________________________________________ >> es-discuss mailing list >> es-discuss at mozilla.org >> https://mail.mozilla.org/listinfo/es-discuss >> >> > _______________________________________________ > es-discuss mailing list > es-discuss at mozilla.org > https://mail.mozilla.org/listinfo/es-discuss > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150811/1ed4f40c/attachment-0001.html>
I vote for no. There is no performance gain and I can hardly see anyone using it. Em seg, 10 de ago de 2015 às 22:18, Isiah Meadows <isiahmeadows at gmail.com>
escreveu:
I vote for no. There is no performance gain and I can hardly see anyone using it. Em seg, 10 de ago de 2015 às 22:18, Isiah Meadows <isiahmeadows at gmail.com> escreveu: > That's not really the point. > > The suggestion is this instead: > > ```js > if (s[0] === '/') s = s.slice(1); > if (s[0] === '/') s .= slice(1); > ``` > > This already exists in CoffeeScript and most derivatives/dialects. > > ```coffee > s .= slice 1 if s[0] is '/' > ``` > > Don't know of any other languages that have an equivalent, though. > > On Mon, Aug 10, 2015, 19:31 Jordan Harband <ljharb at gmail.com> wrote: > >> For that, you'd do `if (s.charAt(0) === '/') { s = s.slice(1); }` - which >> is only slightly more verbose than your example, without the burden of new >> syntax. >> >> On Mon, Aug 10, 2015 at 1:57 PM, Soni L. <fakedme+es at gmail.com> wrote: >> >>> Welp I keep replying this wrong (how should I configure my email client?) >>> ------------------------------------------------------------------------- >>> >>> It /could/ in theory be used like this: >>> >>> function path(s) { >>> if (s.charAt(0) == '/') { s.=substring(1); } >>> // your stuff here >>> } >>> >>> >>> On 10/08/15 04:50 PM, Andrea Giammarchi wrote: >>> >>> not only it's badly readable and reminds me the PHP string >>> concatenation, >>> but it promotes different type assignment which is a performance, and >>> virtually strongly typed, anti-pattern. >>> >>> I think Brendan said already it all, the proposal is badly described, >>> and it solve pretty much nothing in the real world. >>> >>> Probably we can just move on and ignore the list of -1 we'll all put in? >>> ;-) >>> >>> Best Regards >>> >>> On Mon, Aug 10, 2015 at 8:46 PM, <myemailum14 at gmail.com> wrote: >>> >>>> Please no, while i can see how logically it's derived from a = a + 1 >>>> >>>> a = a.f() >>>> >>>> a .= f() >>>> >>>> seems like a bad idea >>>> >>>> i can hardly see the dot >>>> why would i replace the object from which i'm calling the method in >>>> most cases looks inefficient >>>> >>>> >>>> On Mon, Aug 10, 2015 at 2:07 PM, Brendan Eich < <brendan at mozilla.org> >>>> brendan at mozilla.org> wrote: >>>> >>>>> Do not send "Please add" messages with two-line, half-baked sketches >>>>> of extensions to the language. That's just injecting noise with very little >>>>> signal. >>>>> >>>>> The "-1" you received will be the answer if pressed from everyone on >>>>> TC39, I would bet real money. Syntax is expensive, adding it for little >>>>> semantic gain and some downside user-confusion risk (plus a small >>>>> complexity tax hike for the language in full) is never the right answer. >>>>> >>>>> That you can scratch this itch (and many others like it) via sweet.js >>>>> does not argue for incorporating any such =. or .= operator into the core >>>>> language. Analyze developer patterns and nearby languages for better >>>>> candidate extensions that solve more serious usability or greater issues. >>>>> >>>>> /be >>>>> >>>>> >>>>> Florent FAYOLLE wrote: >>>>> >>>>>> Hello, >>>>>> >>>>>>> x .= f() should be syntax sugar for x = x.f() >>>>>>> >>>>>>> x .= f().g().h() should be x = x.f().g().h() >>>>>>> >>>>>> >>>>>> +1! I've made some weeks ago a prototype of this in sweet.js: >>>>>> https://github.com/fflorent/member-access-assignment >>>>>> >>>>>> Except that the syntax is rather =. (I have probably been influenced >>>>>> by the CoffeeScript's existential operator). The reverse looks fine to me >>>>>> too. >>>>>> >>>>>> -1 Please no :) >>>>>>> >>>>>> Why? >>>>>> >>>>>> Florent >>>>>> _______________________________________________ >>>>>> es-discuss mailing list >>>>>> es-discuss at mozilla.org >>>>>> https://mail.mozilla.org/listinfo/es-discuss >>>>>> >>>>>> _______________________________________________ >>>>> es-discuss mailing list >>>>> es-discuss at mozilla.org >>>>> https://mail.mozilla.org/listinfo/es-discuss >>>>> >>>> >>>> >>>> _______________________________________________ >>>> es-discuss mailing list >>>> es-discuss at mozilla.org >>>> https://mail.mozilla.org/listinfo/es-discuss >>>> >>>> >>> >>> >>> _______________________________________________ >>> es-discuss mailing listes-discuss at mozilla.orghttps://mail.mozilla.org/listinfo/es-discuss >>> >>> >>> -- >>> Disclaimer: these emails are public and can be accessed from <TODO: get a non-DHCP IP and put it here>. If you do not agree with this, DO NOT REPLY. >>> >>> >>> _______________________________________________ >>> es-discuss mailing list >>> es-discuss at mozilla.org >>> https://mail.mozilla.org/listinfo/es-discuss >>> >>> >> _______________________________________________ >> es-discuss mailing list >> es-discuss at mozilla.org >> https://mail.mozilla.org/listinfo/es-discuss >> > _______________________________________________ > es-discuss mailing list > es-discuss at mozilla.org > https://mail.mozilla.org/listinfo/es-discuss > -- Iago Sousa -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150811/20e92434/attachment.html>
Isiah Meadows schrieb:
That's not really the point.
The suggestion is this instead:
if (s[0] === '/') s = s.slice(1); if (s[0] === '/') s .= slice(1);
This already exists in CoffeeScript and most derivatives/dialects.
s .= slice 1 if s[0] is '/'
Don't know of any other languages that have an equivalent, though.
Really? Which version of CS, or which dialect are you using? It doesn't work for me in the online tool coffeescript.org/#try:s %3D "%2Fsomething" s .%3D slice 1 if s[0] is '%2F'.
But if you're that much inclined to save single characters, I'd recommend to use
s = s.slice(s[0] == '/');
Bergi
Isiah Meadows schrieb: > That's not really the point. > > The suggestion is this instead: > > ```js > if (s[0] === '/') s = s.slice(1); > if (s[0] === '/') s .= slice(1); > ``` > > This already exists in CoffeeScript and most derivatives/dialects. > > ```coffee > s .= slice 1 if s[0] is '/' > ``` > > Don't know of any other languages that have an equivalent, though. Really? Which version of CS, or which dialect are you using? It doesn't work for me in the online tool <http://coffeescript.org/#try:s%20%3D%20%22%2Fsomething%22%0As%20.%3D%20slice%201%20if%20s%5B0%5D%20is%20'%2F'>. But if you're that much inclined to save single characters, I'd recommend to use ```js s = s.slice(s[0] == '/'); ``` Bergi
Okay... Maybe not CoffeeScript (don't normally use it), but I know a few notable derivatives have that (particularly Coco and LiveScript).
As for the idea itself, still a -1 from me. Unless we add an equivalent for every binary operator, it's not much of an addition. It's just another special case, another band aid. Unless your identifier is 30+ characters, I don't see much benefit. Unlike with numeric operators or string building, this isn't nearly as common beyond that one case (string/array slicing). And for a single character identifier, you're only really saving 1 character. 2 for 2-character identifiers.
There's also no performance gain from it, just sugar. And in the LiveScript code I've seen (a language with this operator), I still rarely see it. That's with a community that enjoys experimenting with the syntax, almost gaming it at times. (Well, there was talk a few months ago about where sugar can become a problem itself, especially when there's 2-3 ways to write 7-8 basic constructs. 1)
Okay... Maybe not CoffeeScript (don't normally use it), but I know a few notable derivatives have that (particularly Coco and LiveScript). As for the idea itself, still a -1 from me. Unless we add an equivalent for every binary operator, it's not much of an addition. It's just another special case, another band aid. Unless your identifier is 30+ characters, I don't see much benefit. Unlike with numeric operators or string building, this isn't nearly as common beyond that one case (string/array slicing). And for a single character identifier, you're only really saving 1 character. 2 for 2-character identifiers. There's also no performance gain from it, just sugar. And in the LiveScript code I've seen (a language with this operator), I still rarely see it. That's with a community that enjoys experimenting with the syntax, almost gaming it at times. (Well, there was talk a few months ago about where sugar can become a problem itself, especially when there's 2-3 ways to write 7-8 basic constructs. [1]) [1]: https://github.com/gkz/LiveScript/issues/721 On Mon, Aug 10, 2015, 22:27 Bergi <a.d.bergi at web.de> wrote: > Isiah Meadows schrieb: > > That's not really the point. > > > > The suggestion is this instead: > > > > ```js > > if (s[0] === '/') s = s.slice(1); > > if (s[0] === '/') s .= slice(1); > > ``` > > > > This already exists in CoffeeScript and most derivatives/dialects. > > > > ```coffee > > s .= slice 1 if s[0] is '/' > > ``` > > > > Don't know of any other languages that have an equivalent, though. > > Really? Which version of CS, or which dialect are you using? It doesn't > work for me in the online tool > < > http://coffeescript.org/#try:s%20%3D%20%22%2Fsomething%22%0As%20.%3D%20slice%201%20if%20s%5B0%5D%20is%20'%2F > '>. > > But if you're that much inclined to save single characters, I'd > recommend to use > ```js > s = s.slice(s[0] == '/'); > ``` > > Bergi > _______________________________________________ > es-discuss mailing list > es-discuss at mozilla.org > https://mail.mozilla.org/listinfo/es-discuss > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150811/91798888/attachment-0001.html>
x .= f() should be syntax sugar for x = x.f()
x .= f().g().h() should be x = x.f().g().h()