es-discuss Digest, Vol 101, Issue 80

Carl Smith carl.input at gmail.com
Mon Jul 27 15:31:00 UTC 2015


It'd be nice if we could have used `with` to set an arbitrary object to
`@`, instead of just `this`.

with (jQuery){ @ajax(options) }

People use delegation far too often.

On Mon, 27 Jul 2015 15:38  <es-discuss-request at mozilla.org> wrote:

> Send es-discuss mailing list submissions to
>         es-discuss at mozilla.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         https://mail.mozilla.org/listinfo/es-discuss
> or, via email, send a message with subject or body 'help' to
>         es-discuss-request at mozilla.org
>
> You can reach the person managing the list at
>         es-discuss-owner at mozilla.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of es-discuss digest..."
> Today's Topics:
>
>    1. Syntax shortcut for accessing properties on the current
>       context   ("this") (Nathaniel Higgins)
>    2. Re: Syntax shortcut for accessing properties on the current
>       context   ("this") (Andrea Giammarchi)
>    3. Re: Syntax shortcut for accessing properties on the current
>       context ("this") (Nathaniel Higgins)
>    4. Re: Syntax shortcut for accessing properties on the current
>       context   ("this") (Andrea Giammarchi)
>
>
>
> ---------- Forwarded message ----------
> From: Nathaniel Higgins <nat at nath.is>
> To: es-discuss at mozilla.org
> Cc:
> Date: Mon, 27 Jul 2015 14:23:24 +0100
> Subject: Syntax shortcut for accessing properties on the current context
> ("this")
> Hi.
>
> In CoffeeScript (and a few other languages including Ruby I believe),
> there is a syntax shortcut for simplifying accessing properties on the
> current context (this variable), which is something you have to do often.
>
> This looks something like `@prop`, which is synonymous with `this.prop`.
> I’m not sure if the “@“ character is used for anything else yet in
> JavaScript, but I’m sure we could find another character to do the same if
> it is.
>
> --
> Nathaniel Higgins
> Sent with Airmail
>
>
>
> ---------- Forwarded message ----------
> From: Andrea Giammarchi <andrea.giammarchi at gmail.com>
> To: Nathaniel Higgins <nat at nath.is>
> Cc: "es-discuss at mozilla.org" <es-discuss at mozilla.org>
> Date: Mon, 27 Jul 2015 14:46:33 +0100
> Subject: Re: Syntax shortcut for accessing properties on the current
> context ("this")
> apparently the @ has been booked already for decorators
> https://medium.com/google-developers/exploring-es7-decorators-76ecb65fb841
>
> I also personally think we don't really need yet another magic shortcut
> that but that's just my opinion.
>
> Best Regards
>
> On Mon, Jul 27, 2015 at 2:23 PM, Nathaniel Higgins <nat at nath.is> wrote:
>
>> Hi.
>>
>> In CoffeeScript (and a few other languages including Ruby I believe),
>> there is a syntax shortcut for simplifying accessing properties on the
>> current context (this variable), which is something you have to do often.
>>
>> This looks something like `@prop`, which is synonymous with `this.prop`.
>> I’m not sure if the “@“ character is used for anything else yet in
>> JavaScript, but I’m sure we could find another character to do the same if
>> it is.
>>
>> --
>> Nathaniel Higgins
>> Sent with Airmail
>>
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>>
>
>
>
> ---------- Forwarded message ----------
> From: Nathaniel Higgins <nat at nath.is>
> To: Andrea Giammarchi <andrea.giammarchi at gmail.com>
> Cc: "es-discuss at mozilla.org" <es-discuss at mozilla.org>
> Date: Mon, 27 Jul 2015 14:47:56 +0100
> Subject: Re: Syntax shortcut for accessing properties on the current
> context ("this")
> Ah yes, silly me.
>
> What about %prop or $prop? When it’s something you have to do a lot,
> repeatedly typing `this.` can be a pain. There’s definitely a case for it
> as many other languages use it.
>
> --
> Nathaniel Higgins
> Sent with Airmail
>
> On 27 July 2015 at 14:46:33, Andrea Giammarchi (
> andrea.giammarchi at gmail.com) wrote:
>
> apparently the @ has been booked already for decorators
> https://medium.com/google-developers/exploring-es7-decorators-76ecb65fb841
>
> I also personally think we don't really need yet another magic shortcut
> that but that's just my opinion.
>
> Best Regards
>
> On Mon, Jul 27, 2015 at 2:23 PM, Nathaniel Higgins <nat at nath.is> wrote:
>
>>  Hi.
>>
>> In CoffeeScript (and a few other languages including Ruby I believe),
>> there is a syntax shortcut for simplifying accessing properties on the
>> current context (this variable), which is something you have to do often.
>>
>> This looks something like `@prop`, which is synonymous with `this.prop`.
>> I’m not sure if the “@“ character is used for anything else yet in
>> JavaScript, but I’m sure we could find another character to do the same if
>> it is.
>>
>>  --
>> Nathaniel Higgins
>> Sent with Airmail
>>
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>>
>
>
>
> ---------- Forwarded message ----------
> From: Andrea Giammarchi <andrea.giammarchi at gmail.com>
> To: Nathaniel Higgins <nat at nath.is>
> Cc: "es-discuss at mozilla.org" <es-discuss at mozilla.org>
> Date: Mon, 27 Jul 2015 15:38:18 +0100
> Subject: Re: Syntax shortcut for accessing properties on the current
> context ("this")
> the real bummer to me is that `with` statement has been deprecated and
> killed without a replacement but AFAIK the "dot-stache" operator should
> come to save us from typing:
>
> ```js
>
> this.{
>   doStuff();
>   doMore();
>   prop = Math.random();
>   console.log(prop);
> }
>
> ```
>
> although I cannot even  find  the strawman ... and this seems outdated
> proposal:
>
> http://wiki.ecmascript.org/doku.php?id=harmony:object_literals#object_extension_literal
>
> it's to define properties only ... uhm ... if I'll find the proposal, I'll
> link  to it.
>
> Best Regards
>
>
>
>
>
> On Mon, Jul 27, 2015 at 2:47 PM, Nathaniel Higgins <nat at nath.is> wrote:
>
>> Ah yes, silly me.
>>
>> What about %prop or $prop? When it’s something you have to do a lot,
>> repeatedly typing `this.` can be a pain. There’s definitely a case for it
>> as many other languages use it.
>>
>> --
>> Nathaniel Higgins
>> Sent with Airmail
>>
>> On 27 July 2015 at 14:46:33, Andrea Giammarchi (
>> andrea.giammarchi at gmail.com) wrote:
>>
>> apparently the @ has been booked already for decorators
>> https://medium.com/google-developers/exploring-es7-decorators-76ecb65fb841
>>
>> I also personally think we don't really need yet another magic shortcut
>> that but that's just my opinion.
>>
>> Best Regards
>>
>> On Mon, Jul 27, 2015 at 2:23 PM, Nathaniel Higgins <nat at nath.is> wrote:
>>
>>>  Hi.
>>>
>>> In CoffeeScript (and a few other languages including Ruby I believe),
>>> there is a syntax shortcut for simplifying accessing properties on the
>>> current context (this variable), which is something you have to do often.
>>>
>>> This looks something like `@prop`, which is synonymous with `this.prop`.
>>> I’m not sure if the “@“ character is used for anything else yet in
>>> JavaScript, but I’m sure we could find another character to do the same if
>>> it is.
>>>
>>>  --
>>> Nathaniel Higgins
>>> Sent with Airmail
>>>
>>> _______________________________________________
>>> 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/20150727/99309f33/attachment.html>


More information about the es-discuss mailing list