Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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?



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.


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


Indeterminate.


"Indeterminate" seems more like "don't know" instead of "don't care"


Good point. I was thinking of things whose state is not proper or measurable.

"Ignored" perhaps?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: