I'll admit I'm not very familiar with the original draft proposal and I appreciate the intentions and the desire to make it a bit more accessible to pragmatic people but please indulge me on a little rant here:
I could not dislike the 'my-' prefix any more. Can we please as an industry of professionals decide to talk about things without having to baby talk it into a who's-on-first routine? Talking about variables in the first person possessive is difficult when the 'person' we are talking about owning it is an abstract block of code. In this proposal it is 'author defined' but really when I read your code, It is yours… and now it's mine… or maybe it's ours. Or perhaps it belongs to that block of code. What doesn't change is that it's a variable (or property).
I know that's probably a minor point but it annoys me.
Secondly, I think the $() syntax needs to be weighed against the cost of having nesting there. Is $ not enough to indicate a reference? I guess the idea is to use that to provide a default but I don't like having to always type out the parens for it.
A link to the draft in github is in the article so fork, send a pull, suggest away. I would suggest a read through the variables draft and a search on hn and www-style list to see the previous confusion caused by using not just the word variable, but the prefix var- and non-paren form you suggest.
I want to agree with po from an entirely different point of view--a non-programmer often trying to figure out how a particular program (in a language I don't know) works.
If I spot the "my" or "my-" prefix, I take it that the corresponding token (e.g. "mypref", "my-limit") is not a reserved term of the language, but one the programmer is defining or assigning. So the "my" prefix can be helpful (at least to some non-programmers) and I don't want it co-opted to become a reserved word.
Just for complete clairty, my-* does in fact indicate a token that the author/programmer is defining (a custom property), in the same way that data-* properties do in HTML, which is why my-* was used. But I understand that you dislike it and I can appreciate why. As I mentioned to Po, the draft is open on github, and you are free to make better suggestions here as well... I don't think anyone is particularly married to my- we do know that var- and data- have caused what we think was unnecessary confusion. Set- was proposed and denied. What are your thoughts - that's what this is all about. Let's not wind up with something that people find unintuitive if as a community we can make it better.
6 comments
[ 4.3 ms ] story [ 26.4 ms ] threadI could not dislike the 'my-' prefix any more. Can we please as an industry of professionals decide to talk about things without having to baby talk it into a who's-on-first routine? Talking about variables in the first person possessive is difficult when the 'person' we are talking about owning it is an abstract block of code. In this proposal it is 'author defined' but really when I read your code, It is yours… and now it's mine… or maybe it's ours. Or perhaps it belongs to that block of code. What doesn't change is that it's a variable (or property).
I know that's probably a minor point but it annoys me.
Secondly, I think the $() syntax needs to be weighed against the cost of having nesting there. Is $ not enough to indicate a reference? I guess the idea is to use that to provide a default but I don't like having to always type out the parens for it.
Why do you think the term 'variable' is the source of confusion and 'property' is better? If so, why not use a 'prop-' prefix?
The more discussion and argument the better IMO.