satyr / coco

Unfancy CoffeeScript
http://satyr.github.com/coco/
MIT License
498 stars 48 forks source link

`~!` as `.call(this)` #211

Closed vendethiel closed 9 years ago

vendethiel commented 11 years ago

Pretty minor. Here ? (I'd like to avoid creating mess then "will get my hands dirty" 'cause what I did was pure crap)

a.b~! => a.b.call(this)

(since we already have ~ as bound access.)

satyr commented 11 years ago

Desugaring to what, a.b.~()? Doesn't look right as we don't allow a.b.().

vendethiel commented 11 years ago

Even if it doesn't really make sense for a simple call (.()), that could go beyond !. I don't really mind the syntax - I just chose that because that was composed of bound access and bang call.

a~(1) # a.call(this, 1)
a~! # a.call(this)
# but it doesn't look alike this :
a ... # a.apply(this, arguments)
satyr commented 11 years ago

Note that a.b.~(c) is already taken.

vendethiel commented 11 years ago

Ah, indeed, a.(b) is taken. My bad, I didn't even thought about that. Not sure what then.

vendethiel commented 11 years ago

related : gkz/LiveScript#249, proposing postfix @

redexp commented 10 years ago

how about this?

a..(1) # a.call(this, 1)
redexp commented 10 years ago

and extend a... with params

a...([a, b]) # a.apply(this, [a, b])
a...(b) # a.apply(this, b)