BUG? or inside argument list

Hi,

I get a syntax error when I try to use "or" inside a argument
list:

#doesn't work:
puts(nil or "string")
String.new(nil or "string")

#the following works:
puts (nil or "string")
String.new((nil or "string"))

It appears that Ruby accepts the "or" when it parses it as an
expression, but not when it parses it as an argument list.
Isn't any expression valid inside an argument list?

$ ruby --version
ruby 1.8.2 (2004-07-16) [i386-linux]

Regards,
KB

Kristof,

You can use the '||' operator instead of 'or' in argumet lists:

puts(nil || "string")
String.new(nil || "string")

···

On Fri, 27 Aug 2004 19:30:43 +0900, Kristof Bastiaensen <kristof@vleeuwen.org> wrote:

Hi,

I get a syntax error when I try to use "or" inside a argument
list:

#doesn't work:
puts(nil or "string")
String.new(nil or "string")

#the following works:
puts (nil or "string")
String.new((nil or "string"))

It appears that Ruby accepts the "or" when it parses it as an
expression, but not when it parses it as an argument list.
Isn't any expression valid inside an argument list?

$ ruby --version
ruby 1.8.2 (2004-07-16) [i386-linux]

Regards,
KB

--
Lennon
rcoder.net

Yes, I found out that '||' works, but I prefer "or" because it looks
better. I find that the english words express better the meaning than
symbols. If I am correct the english versions and symbol versions are a
bit different (preference rules or something), but it is strange that they
aren't allowed inside an argument list. Is there a reason why this
is so, or is it just a bug?

Thanks,
KB

···

On Sat, 28 Aug 2004 02:03:43 +0900, Lennon Day-Reynolds wrote:

Kristof,

You can use the '||' operator instead of 'or' in argumet lists:

puts(nil || "string")
String.new(nil || "string")

I have to say, it seems odd to me, to... perhaps it's an unintentional limitation in the parser? And I agree about the "or" vs "||" thing... whenever I have the choice, I prefer "or". it's easier to type, and it looks nicer.

cheers,
Mark

···

On Aug 28, 2004, at 10:20 AM, Kristof Bastiaensen wrote:

On Sat, 28 Aug 2004 02:03:43 +0900, Lennon Day-Reynolds wrote:

Kristof,

You can use the '||' operator instead of 'or' in argumet lists:

puts(nil || "string")
String.new(nil || "string")

Yes, I found out that '||' works, but I prefer "or" because it looks
better. I find that the english words express better the meaning than
symbols. If I am correct the english versions and symbol versions are a
bit different (preference rules or something), but it is strange that they
aren't allowed inside an argument list. Is there a reason why this
is so, or is it just a bug?