-
Notifications
You must be signed in to change notification settings - Fork 48
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
hyphens for identifiers #137
Comments
Makes me think about jashkenas/coffeescript#425 |
Hm? I don't follow. Can you show me code example(s) that would be problematic? |
|
Expected since
|
obj:
real-name: 'coco'
attribute = 'real-name'
obj[attribute] obj will be {realName: 'coco'}, and that co will do obj['real-name'], so that'll fail. |
Note that plain JS has similar quirks as well:
They are trivial compared to the incompatibility:
|
IMO, this feature sounds unnecessary and may hurt readability
vs
vs
long variable name should be completed by editor so what separate words don't matter so much |
After using it, I have the feeling that it's not so bad. |
I'm pro-this, by the way; although it's odd that
|
ups: 2, downs: 1
It comes to matter when you're dealing with public API, where camel case is the de-facto standard. |
I'd like to see this removed. It's confusing and pointless. Variables compile to camelCase, so why not just use camelCase? Instead when reading code, one has to have more cognitive overhead to understand this fact. Also, as a snake_caser, I feel alienated. |
You deserve it. JavaScript has never been java_script. |
That's title case! |
it's so more readable with dashes than being camelCased ... |
And here's another thing: For some language features, if you don't like them, you can simply avoid them. For this language feature, I am forced to understand this concept, because this seemingly simple code:
Compiles differently than I think it should. So every line of code which has a dash, I have to keep this cognitive overhead in mind, even if I don't use dash-variables anywhere. This feature makes the learning curve of coco steeper, harms the readability of coco, and the benefit that it gives is subjective. My subjective view of the way dash variables look is that they look harder to read than camelCase. |
Also just to be clear, when I say I am a snake caser, this is what I mean.
One convention to rule them all. |
|
I've read some science article about how is the brain reading, and apparently it's not that "subjective", the brain does the separation better. |
The fact that the brain separates the words better makes it less readable. You don't want to read aVariableName as 3 words; you want to read it as one word. |
It depends whether I want it to be understandable or not, I guess. |
I am porting some code to coco from coffee-script, and now I have to go through the code looking for this. |
Why? Were you using this feature even though you didn't like it? |
from coffeescript to coco Because the code might have |
It actually was pretty painless with a good regex, but it seems relevant to this thread. |
@superjoe30: Ever heard of regexps? edit: looks like you have |
Something like |
gkz/LiveScript#28
jashkenas/coffeescript#2370
Allow
-
before an alphabetic character within identifiers just like Perl6, transforming to camelCase.Pros
Cons
x-y
will no longer be a subtraction.Thums-{up,down}s?
The text was updated successfully, but these errors were encountered: