News for hackers. Stuff that matters.
Re:Ruby’s magic underscore by majormajor on Saturday September 22, 2012 @01:17PM (#4558378)
Great post! I had no idea that Ruby supported _ for "don't care" in block declarations like that.

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?

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.
Re:Ruby’s magic underscore by Finbarr on Sunday September 23, 2012 @01:24AM (#4560123)
How about indifferent?
Re:Ruby’s magic underscore by Someone on Sunday September 23, 2012 @05:54AM (#4560507)
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.
Re:Ruby’s magic underscore by drifkin on Saturday September 22, 2012 @11:15PM (#4559837)
Do other languages have a word for this?
Re:Ruby’s magic underscore by njharman on Sunday September 23, 2012 @03:05AM (#4560268)
foo
Re:Ruby’s magic underscore by Daniel_Newby on Saturday September 22, 2012 @11:15PM (#4559834)
Indeterminate.
Re:Ruby’s magic underscore by drifkin on Sunday September 23, 2012 @12:03AM (#4559939)
"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?