on 6/11/03 11:28 PM, Daniel Carrera at dcarrera / math.umd.edu wrote:
> Yes, I agree.  I think it's best to give some code examples.  This is what
> I'd suggest.
...
> Example 1:
> # Factorial.
> class Fixnum
>   def _! 
>     self <  0 and raise "Factorial only defined for non-negative numbers"
>     self == 0 and return 1
>     self * (self - 1)._!
>   end
> end

Wehn presenting a new language, I would shy away from statements that (I'm
having a hard time wording this) don't directly convey meaning. Ie.

    self < 0 and raise "Factorial only defined for non-negative numbers"
    self ==1 and return 1

Particularly the second statement, as it could easily be mistaken for an
assignment. I would prefer:

    raise "Factorial only defined for non-negative numbers" if self < 0
    return 1 if self == 1

I've never cared for the 'foo and bar' 'foo or bar', as I always have to
think them through ("okay, if self is less than zero, it will return true,
meaning the second part of the statement will be evaluated." In the case of
"or": "okay, if whatever is greater than that constant, it will return true,
and the rest of the statement won't have to be evaluated, so if that's true,
don't do that")

Probably a deficiency in the Boolean section of my brain. Of course Perl
people will eat it up, since they like to:
    (foo == bar) && foo = bar
and the like.

Just some ramblings.

-- 
Regards,
  JJ

Be Kind, Be Careful, Be Yourself

ps. Off to work, no time for spell check.