{"issue":{"milestone":null,"title":"Variable name with any character and whitespace","created_at":"2011-12-28T16:38:59Z","user":{"login":"johnnywengluu","id":445841,"url":"https://api.github.com/users/johnnywengluu","gravatar_id":"d084e44bfe1566d87abf80d1f6c0b8a4","avatar_url":"https://secure.gravatar.com/avatar/d084e44bfe1566d87abf80d1f6c0b8a4?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"labels":[{"name":"enhancement","url":"https://api.github.com/repos/jashkenas/coffee-script/labels/enhancement","color":"84b6eb"},{"name":"wontfix","url":"https://api.github.com/repos/jashkenas/coffee-script/labels/wontfix","color":"ffffff"}],"updated_at":"2011-12-30T02:12:01Z","state":"open","id":2672651,"closed_at":null,"html_url":"https://github.com/jashkenas/coffee-script/issues/1982","pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"body":"These features kinda have something in common so I just put them in the same request:\r\n\r\nFeature 1:\r\n\r\nOne feature I would like to see is the ability to use whatever character as name eg.\r\n\r\n    ƒ = (name) -> ...\r\n\r\n    ƒ \"load models for view\"\r\n\r\nor\r\n\r\n    π = 3.14\r\n\r\nThis is already possible (also means that it's simple to do in JS) if you are doing like this:\r\n\r\n    o =\r\n      \"ƒ\": (name) -> ...\r\n\r\n    o[\"ƒ\"] \"load models for view\"\r\n\r\nIf this was a built in feature we wouldn't have to declare it as an object method and also don't have to call it with brackets.\r\n\r\nWhy should $ be allowed and not ß Ω £ π and others.\r\n\r\nI can't think of any drawback with this feature since it's already possible, with more code. CS would just make this simpler so the code gets prettier.\r\n\r\nFeature 2:\r\n\r\nAnother thing I would like to see is acceptance of whitespace in variable names eg:\r\n\r\n    `create a new app` = (app) -> ...\r\n\r\n    `create a new app` \"test\"\r\n\r\n    o =\r\n      \"create a new app\": (app) ->\r\n    \r\n    o.`create a new app` app\r\n\r\nThese are just suggestions borrowed from Ruby where it runs a shell command:\r\n\r\n    `echo hello`\r\n\r\nAlso Neo4j is using them to allow attributes with whitespace:\r\n\r\n    person.`first name`\r\n\r\nWhy I think it's a good suggestion.\r\n\r\nI know it's an old habit to use camelCased variable names but I just don't know why we still have to do that. It collides with literate programming. Also being forced to hit SHIFT for each word just doesn't make sense, not to mention that this just makes the whole program _much_ more fun to read. Just read it like you read a book. Why suddenly reading sentences in camelCase or preventing variable names to be too long (thus unreadable)?\r\n\r\nI could only imagine that this would open a new door for literate programming style in CS. No need to declare a function and have a comment above it explaining what it does. The code itself should be the documentation.\r\n\r\nAnd as mentioned you can already have whitespace but a lot of programmers don't want to do something like:\r\n\r\n    o[\"create a new app\"] app\r\n\r\n    o[\"load view for page\"] = (page) -> ...\r\n\r\nwhy everyone still prefers camelCasing the name.\r\n\r\nJavascript is very flexible under the hood but it's not smart enough to allow users to use the cool features with ease. \"Smell but don't taste\".\r\n\r\nFor me this is something CS could take care of very easily and would make everyone love to have descriptive names thus indirectly making the whole app more of a literate program, for free.","number":1982,"url":"https://api.github.com/repos/jashkenas/coffee-script/issues/1982","comments":22,"assignee":null},"comment":{"created_at":"2011-12-30T02:12:01Z","user":{"login":"johnnywengluu","id":445841,"url":"https://api.github.com/users/johnnywengluu","gravatar_id":"d084e44bfe1566d87abf80d1f6c0b8a4","avatar_url":"https://secure.gravatar.com/avatar/d084e44bfe1566d87abf80d1f6c0b8a4?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"updated_at":"2011-12-30T02:12:01Z","id":3308639,"body":"@michaelficarra For the same reason you would want to use it in object properties. You aren't forced to, but the feature is _already_ there for a reason. A gain is that I just type as I always type when having multiple words. A gain is that I just read it as I always read when there are multiple words. Programming langs are moving forward. Let's think about the _why nots_. Why not use white space instead of a _ hack. I mean yeah, that has been how it has always been done, but why not just allow white space. Why make so much resistance for a such reasonable thing? To be honest, I think this has become more of a religion thing, why I hope hearing more solid args.\r\n\r\nAlso keep in mind, yet again, it's already there in JS. I propose that CS, once again, fixes yet another thing JS should have been doing if they thought about the users. { \"They have it like this\": \"for a reason\" }. But then they say to the users: \"yes we allow it, but you have to type more, hah!\" Now, that's a WTF. But it's JS so...\r\n\r\nCan't get why having this as an alternative is such a big no. CS is already giving people choice, it's in it's core philosophy, and this choice won't be a WTF one imo.","url":"https://api.github.com/repos/jashkenas/coffee-script/issues/comments/3308639"},"action":"created"}