On 10/13/07, Roger Pack <rogerpack2005 / gmail.com> wrote:
> I also wonder if the complex defined? api explains why this code:
> assert(defined?(a) and defined?(b))
> throws a syntax error for some reason.

No. That's an unfortunate situation with the "and" and "or" in Ruby:

>> def foo?(ob)
>>   ob.to_s == "foo"
>> end
=> nil
>> foo?("foo") and foo?("bar")
=> false
>> def baz(truth)
>>   puts "You can't handle the truth."
>> end
=> nil
>> baz(foo?("foo") and foo?("bar"))
SyntaxError: compile error
(irb):8: syntax error, unexpected kAND, expecting ')'
baz(foo?("foo") and foo?("bar"))
                   ^
(irb):8: syntax error, unexpected ')', expecting $end
        from (irb):8
>> baz(foo?("foo") && foo?("bar"))
You can't handle the truth.

-austin
-- 
Austin Ziegler * halostatue / gmail.com * http://www.halostatue.ca/
               * austin / halostatue.ca * http://www.halostatue.ca/feed/
               * austin / zieglers.ca