4 ms·
..sorry but this is a non-problem. If you insist on not using an IDE, then the compiler will still catch any keyword clashes as errors. Also most languages use
by hacker_9 11y ago
..sorry but this is a non-problem. If you insist on not using an IDE, then the compiler will still catch any keyword clashes as errors. Also most languages use contextual keywords so it's even less of a problem.
- sdegutis 11y agoRight. I think I've never wanted to name a variable "if".
- paulddraper 11y agoBut what about old, current, and new? Or int? Or class? There is more then one project out there with klass.
- Retra 11y agoI name variables 'old', 'current', and 'new' all the time. Just not in C++/Java. And why would you want to name a variable 'int'?
- paulddraper 11y agoOr in JS. Or in C#. That covers a lot of the big ones. Perhaps you should name your language, so I can provide better examples.
- Retra 11y agoExamples of what? Ways to name variables so they look like keywords? I don't need your help with that. Even if I used a language that used keywords like 'ssalc' and 'wen', you could contrive some reason to be upset that you can't use those words in your code. The advantage offered by keywords is readability, and it comes at the expense of your ability to use those words for other purposes. If that's unacceptable, then your priorities are probably misplaced. Plus, you can always use a grammar that distinguishes between keyword rules and variable rules, and you'll never have any unambiguity. Even if popular languages don't do this, that's not a general problem for computer languages.
- paulddraper 11y ago> Ways to name variables so they look like keywords? I don't need your help with that. Oh good. My comment was in response to someone who doubt keywords would ever make good variable names (e.g. class). > you can always use a grammar that distinguishes between keyword rules and variable rules, and you'll never have any unambiguity. Yes, that is nice. And that's what W does. As an ancestor comment said, kudos for a "clean syntax"! (NOTE: there are alternatives, e.g. Scala's backticks. But W's choice is a good one.)
- hacker_9 11y agonew what? Usually you'd say newItem for example. Also, if you really want, in C# you can write @class.