From: William Djaja Tjokroaminata Date: 2002-09-10T03:52:12+09:00 Subject: Re: Ruby aesthetics Hi, In principle I agree with everything that you said. I myself always use both "if" and "unless" in my code, and I don't think I will have trouble reading other people's code either regarding this. I think the point is whether one way or the other is better, and I feel that there is an advantage of being a minimalist language like Python. I also once thought that for my own code, probably I can always use "if !" and never "unless" in Ruby. But there are two problems (for me): 1) If I never use "unless", probably I will forget that such a keyword exists (not counting the (unlikely) case if I use "unless" as a name for a variable; well, it happened once that I used "continue" in C for a variable name) 2) To some degree, probably each of us has some pride on the code that we write. If I share my code at one point in the future, probably there is some uneasy feeling that some people may think, "hey, does this guy know that there is unless in Ruby?", although what I have tried to do is only to be consistent by always using "if !" and not "unless". I don't think both 1) and 2) will ever occur in Python. Finally, how does one feel if encountering the following C code: #define unless(x) if (!(x)) Does this contribute to the expresiveness, or does it add to more confusion? By the same token, does "unless" really contribute to the expresiveness, or just add more things to memorize? If "unless" really is expressive, why not everybody defines the macro above when coding in C? Regards, Bill ========================================================================== dblack@candle.superlink.net wrote: > Most of what's been mentioned in this thread, though, has to do more > with synonymy than ambiguity; that is, "unless" and "if not" mean the > same thing in Ruby, but neither is ambiguous. > There's also a useful distinction to be made, I think, between active > and passive knowledge of the language. When one writes code, one can > restrict oneself to "if not" (or "if !") if one wishes to; there's no > imperative to alternate or rotate among synonyms. So then the only > question remaining is... can one understand other people's code, even > when they sometimes say "unless" and sometimes say "if not" (or > "indexes" and "indices", or whatever)? > And the answer is... well, I can only answer for myself: I have no > memories of finding Ruby's synonyms to be a stumbling block to reading > other people's code (all else being reasonably clear :-) > David > -- > David Alan Black | Register for RubyConf 2002! > home: dblack@candle.superlink.net | November 1-3 > work: blackdav@shu.edu | Seattle, WA, USA > Web: http://pirate.shu.edu/~blackdav | http://www.rubyconf.com