3 ms·
Yeah, I could see a language taking the position that referencing fooBar as FooBar is an error, and that level of case-sensitivity makes sense to me (my name is
by Pxtl 8y ago
Yeah, I could see a language taking the position that referencing fooBar as FooBar is an error, and that level of case-sensitivity makes sense to me (my name is Martin not martin) but allowing both Martin and martin to exist as distinct identifiers is crazy.
On the subject of spaces, I do wonder why no language has used enough punctuation to make spaces allowed in identifiers. I mean, most Algol-derived languages could get away with it if they put punctuation between type keywords and variables:
private, my class: my instance = my factory function(my parameter one, my parameter two);
- jfk13 8y ago> make spaces allowed in identifiers IIRC from my days at Cambridge, Algol68 allowed that. (Our local variant was Algol68C.)
- ken 8y agoLisp allows spaces in identifiers, or any other character. You just have to escape them: (defun |my + function| (x y) (+ x y)) (|my + function| 2 2) (Or maybe write a reader macro to deal with them in some other way.)
- Pxtl 8y agoHah, that's even uglier than the SQL "just put square brackets around it" approach. We're looking for something nicer than underscores and hyphens.
- andreareina 8y agoBeing that whitespace is the primary way most languages separate tokens, yeah putting whitespace inside tokens is going to be ugly.
- yoz-y 8y agoRobot testing framework language does allow spaces in identifiers and it is a terrible idea.