coco
coco copied to clipboard
Property names and string literals
Maybe it would be good to remove the ':'
character from the \notation
.
Right now : a = \b: 1
produces an error ; we have to write a = \b : 1
It's not really bothering, but it just would be nicer.
Hm, it's a trade-off. Take a look at package.co.
-
homepage : \http://satyr.github.com/coco/
-
\uglify-js : \1.0.6
The former would become invalid, meanwhile the latter would be able to remove the space before :
. I'm unsure if we'd be happier.
And if :
were to join ,
/;
, other punctuations like .
/?
/!
also become debatable.
Personally I think it's user-friendlier to have less exceptional characters as possible. Opinions?
-1 on removing ':'. It helps distinguish labels from function invocations.
scribu: how ? with a good syntax highlighter, the label will always look different. And a string is not a function ?
satyr: I get that this is one less character to type, but when a string is already > 10~15 letters, why not quoting them ?
One less character is the whole point of the syntax. Should length matter?
One less character is the whole point of the syntax. Should length matter?
I agree :)
Though I (personnaly) found it nice to use it as a string with meaning, whereas I use "" whenever I'm having something more textual.
IE:
$ \.delete-button .text "Delete"
Plus, I configured vim to color it differently. Handy.
I don't understand the purpose of "" - it's just a string with one less character (")?
a = { "b": 1 } # JavaScript - pretty obvious
a = "b": 1 # Starting to feel ambiguous - true ? "b": 1
a = \b: 1 # This reminds me of "\b" - is \bb legal?
I've been following CoffeeScript and like what Coco "fixes", but I'm dubious of syntax that only removes a few keystrokes. I think it also makes it more confusing since you can do the same thing with two syntaxes and the usage is arbitrary. x = \a + "b" + 'c';
Just my 2c. I'm new here :) I've also looked at Kaffeine, which has a good feel to it, but the author doesn't have much time to work on it.
Mike
is \bb legal?
Sure.
but I'm dubious of syntax that only removes a few keystrokes.
Then transpilers like CoffeeScript/Coco, which exist purely for removing key strokes, is probably not for you.
transpilers like CoffeeScript/Coco, which exist purely for removing key strokes
I think that's inaccurate. The main goal, for CoffeeScript at least, isn't to remove key strokes, but to have a more expressive, yet forgiving, language. At least that's how I see it.
To clarify, "being more expressive" usually means "less keystrokes", but not always.
Also, you can reduce the length by 1 character, but severely impact readability in the process, which scores low on the "being more expressive" chart.
\r\n === "r\n"? \ === ""?
Maybe it's just the \ symbol I'm weary of since it's often used inside strings. But then again, " used inside strings can get pretty hairy too:
""hi""
I'm not adverse to removing keystrokes - I prefer => over function(), implicit returns in lambdas, etc. - just not so much when it can be done in a very similar way.
Mike
@scribu:
I think that's inaccurate.
Uh yes, sometimes they add keystrokes as well. "Changing key strokes" is more accurate.
The main goal, for CoffeeScript at least, isn't to remove key strokes, but to have a more expressive, yet forgiving, language. At least that's how I see it.
Right. Jeremy wanted CoffeeScript to be a literate programming language, making it close to English as possible.
Coco's goal is a little different, as I believe English (or any natural language) is total crap.
@mikeaustin:
Maybe it's just the \ symbol I'm weary of since it's often used inside strings
I worried this as well, but there really were no other symbols that fit. See also: gkz/LiveScript#25