Asked 2 years ago
I guess I like "is" for equality, and would prefer something like "handles" or "supports" for your other case. For reference, ruby uses "responds_to" to check for method existence.
"is" is a terrible word. It will certainly confuse people whose first language is not English. Does "is" mean "permanent state" ("the mountain is high") or "transitory state" ("he is outside at the moment")? Other languages distinguish these with different verbs. Also, "is" does not mean "has", so your first example might be better expressed as "if a has printability" or much more simple as "if a can print". For the second example, I would suggest "if a equals b" for clarity. I would, however, recommend not using words at all in a programming language if possible. Real engineers use better constructs.
I think your question implies that 'is' should either be used for both, or is should only be used for identity, and 'has' should be used for the posession of a property.
nelhage, zellia, quince, ctl, Lex, Yoyo, paigep, shadow, ocschwar, michael, geoff
Any brilliant advice would certainly be appreciated. Shameless advocacy is often good, too.
but why not both?
property is theft. Embrace the state.
If your language is intended to have operator overloading, the equality operator should be overloadable and I personally prefer operators to not be keywords (new notwithstanding).
Alex, Ian, crs, trs, aletta, seph, jtu, lakmiseiru, susannah, jesse, tibbetts, raf, riv, jonas, sauergeek, daveman692, jake, zkzkz, Diane, acme, Kake, Combaine, transistorman, fuggles
Copyright © 2006–2007 Best Practical Solutions, LLC • Contact us
If you make a stupid choice because a website tells you to, it's your own damn fault.