-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Free up yes/no/on/off (or remove them entirely) #813
Comments
If we ever remove |
I wouldn't miss |
I tend to agree with Trevor. I sort of think they're a bit silly in the first place though. Useless reserved words for the loss? |
Hmm.. I actually never use I find myself using booleans most often to enable or disable functions and features ( I can see why you could say But I agree it's a very small thing, and all aesthetics. |
If we were to remove them, removing the other pure aliases ( edit : #814 |
I think the question there is "what improves readability?" If yes/no on/off improve readability, it makes sense to keep them. I think not/is/isnt/and/or definitely do, but it's all quite subjective. |
I do use That said, replacing them with |
|
If people would like using |
I have to say that I'm a bit afraid that CoffeeScript is losing its soul. -- Isn't "reading like a natural language" one of the goals of CoffeeScript? Maybe these goals could be mentioned in a new Intro on coffeescript.org, so we can get everyone aligned with CoffeeScript's original intentions. jashkenas, what do you think? |
devtime: That sounds like a fine idea -- to have a section on philosophy. The idea with CoffeeScript is to create a readable and minimal language that sticks close to JavaScript, while papering over its rough edges, and providing idioms for common patterns. Naturally, those goals are in direct tension with one another -- readability and succinctness are not always the same, and adding common idioms is difficult to do while keeping the language minimal. Balancing those goals is the challenge that we're addressing by discussing issues such as this one. |
jashkenas: Indeed. It's a balancing act, like living one's life. :) |
IMO its one of Coffeescripts's bests to get more readability out of my source. Yes/No (in addition to true / false) reads just perfect in most circumstances. I think @DEVTIME got it right: CoffeeScript would lose its soul. |
I like |
I say keep em! (altough I dont use em much, but that is because I came from plain js). CS should keep stuff that improves readability |
< pun > devtime nailed it ! |
After reading the other replies, I've reconsidered. yes/no/on/off can be nice for some things, and makes code a bit more readable and descriptive. That outweighs the tiny downside of reserved words clutter. I say keep 'em. |
OK, I'm fine with keeping the synonyms, since several folks seem to feel strongly about them. I must say that I'm very surprised to hear more people express support for keeping |
That's how eye-catches work. However stupid they actually are. |
Just in case: are you guys aware that once we free up them, you are free to do |
We lose proper syntax highlighting, we lose a common agreement on what |
Great -- readability carries the day -- despite YAML desiring to move closer to JSON. If you don't like them, you don't have to use them. Closing the issue as a |
That was never an issue to begin with. The culprit is that you can't use them as identifiers like you can do in JS. |
satyr:
I quote devongovett:
|
Well, let's hope that when people come to CoffeeScript they'll learn to give more meaningful names to their variables, too! :D Anyway, IMO, the benefits outweigh the rare difficulty in converting code from JavaScript. |
And what benefits are those? We end up with inconsitent code across lines/people/projects. |
satyr, as you can see from several comments here, people are using them because clearly they benefit from them. Otherwise they wouldn't use them. Mainly it gets used by seasoned CoffeeScript programmers when it expresses the purpose of the code better than a plain Besides, it's cool, and CoffeeScript is about coolness too, where it is not expensive. ;)
Then establish some conventions with those projects / people. The same problem goes for how APIs are named. |
Readability is very important to me, I love this design philosophy of Objective-C, which has YES and NO and long method names that document the API well. CoffeeScript is nothing near Obj-C of course in this regard, it's short and sweet but way more readable than JS. I am glad Jeremy decided to keep them; I think it would be very un-CoffeeScript like to have ejected them. This language really has some integrity and that is important. |
I've recently run into wanting to be able to define |
Remove them who clutter up namespace, replacing with
yes = on = true, no = off = false
predefined on top for backward compatibility.The obvious benefit:
The less obvious benefit:
true
/false
if you concern performance.The text was updated successfully, but these errors were encountered: