-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
shortcut syntax for this. and prototype. #37
Comments
I like it. "@" is my fave between the 3. |
I would also love having this. |
I hate "prototype" keyword. "@" is a good idea. |
|
I'm an advocate for :: for prototype and @ for this |
I've added
I'm leaving Closing the ticket. |
:-( aah that's a shame about I think that the main usefulness is not so much todo with the typing, but with it's ease of reading, e.g.: x: if this.sq then this.sq[0]*this.sq[1] else null vs y: if @sq then @sq[0]*@sq[1] else null It seems that quite a few of us 'early-adopters' liked it a lot and while I understand that you don't want it to obscure some fundamentals, particularly for newcomers (which I think is a good goal to aim for), it's easy to understand and explain: Tortoise: what does this As it's entirely optional, perhaps it could be an 'advanced feature' ? |
Reopening this ticket. My apologies for closing it in the first place. Before we implement
Just
Are there other precedents from other languages, apart from |
I still like "@". "/" could be confused with divide "." is too hard to see (yeah i probably need glasses :-) ) ~ is a pain to type and reminds me of the bitwise operator. would :property work? if so, that would be my second choice only because it's a bit hard to see (i like it because it seems related to :: ). |
if you have
(this binding) or we go the ~ way and also change => to ~> |
The advantage Regarding standalone |
I like I also like
I think As for |
I agree, having to think about what kind of ":" is a major negative. |
Cool. Thanks for all the votes.
It can be used for method calls and property accesses, as well as the start of a longer chain: I left in the naked Closing the ticket. |
awesome! Thanks Jeremy! |
Lovely :) Off Topic javascript question => Can someone explain how the |
It's bound by calling context. The function is invoked via bob's dot operator, so it's bound to him. In other words, bob.hello() is equivalent to bob.hello.call(bob) |
Weepy: What you mentioned is the absolute worst part of JavaScript -- the dynamic scope that Background reading: One last alternative that's worth thinking about is using Stan's example from the commit becomes:
My test from above becomes:
Clearly would work better for properties than for methods. |
From what I've read in other explorations in the issues list, I'm guessing that it would be hard to 'fix' the lousy dynamic scope of |
That's actually what the fat arrow |
having @ now, makes me feel the fat-arrow could be confusing. what about something like
for binding this and adding the option to bind to any given scope -somescope> or with parens for readability?
just some thaughts and maybe pointless :-) |
Suggestion, as this. and prototype. are typed alot in JS, it would be useful to have a shortcut.
E.g.
Other suggestions were to use
..
or::
.@
has some parity with Ruby.The text was updated successfully, but these errors were encountered: