Re:Ruby’s magic underscore
by jordanthoms on Saturday September 22, 2012 @09:17PM
(#4559610)
slightly off topic, but it's always seemed weird to me that there is no english word for "don't care", it's a really awkward phrasing. - In boolean logic, we have true, false, and then no word for when it can be either.
How about indifferent?
SQL has NULL.
Digital electronics has 0, 1 and x.
Java/C# have Boolean/bool?, with values true, false, and null.
English has apathetic, neutral, unbiased, nonpartisan.
Re:Ruby’s magic underscore
by jordanthoms on Sunday September 23, 2012 @10:37AM
(#4561019)
To me NULL means more that there is no value, not that there is a value, but I don't care what it is.
Do other languages have a word for this?
foo
Re:Ruby’s magic underscore
by Daniel_Newby on Saturday September 22, 2012 @11:15PM
(#4559834)
Indeterminate.
"Indeterminate" seems more like "don't know" instead of "don't care"
Re:Ruby’s magic underscore
by Daniel_Newby on Sunday September 23, 2012 @12:13AM
(#4559961)
Good point. I was thinking of things whose state is not proper or measurable.
"Ignored" perhaps?
Ever since I first saw it in Prolog, I've loved the idea of having a special symbol for "don't care", and I find the examples using it in this article to be much more immediately clear than the ones with unused variables (once you know about the _, at least). While it doesn't provide the same level of functionality here as in Prolog, being just a nice little indicator of unuse here, using duplicate names for unused variables, feels much more sketchy to me -- a non-underscore variable name just doesn't stand out as immediately noticeable in the same way.
And allowing duplicate names as a general rule, not just for one special case, seems a much more likely thing to trip up inexperienced programmers in the future. Say someone was lazy and used "x" as their unused variable, and someone newer to the language came along and didn't notice the duplication and actually used the x variable for something?