Syntax shortcut for accessing properties on the current context ("this")
Michael McGlothlin
mike.mcglothlin at gmail.com
Mon Jul 27 16:03:50 UTC 2015
I'd rather that prop just match the object the method is actually attached to, regardless of the context of 'this', before continuing searching the tree. Familiar as its done that way in many languages, short, and independent of 'this' context.
A context operator might be a good idea though. Maybe by itself it'd be equiv to this but could also be used to reference the function itself, the attached object, etc. #.prop, #function.prop, #object.prop, etc?
Thanks,
Michael McGlothlin
Sent from my iPhone
> On Jul 27, 2015, at 8:23 AM, 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150727/5fbea510/attachment-0001.html>
More information about the es-discuss
mailing list