On Tue, Aug 13, 2002 at 01:15:11AM +0900, Dossy wrote:
> No surprise, right?  Then why does this happen:
> 
>     irb(main):003:0> FalseClass?0:1    
>     SyntaxError: compile error
>     (irb):3: parse error
>     FalseClass?0:1
>                  ^
>             from (irb):3
> 
> The compiler should know that FalseClass is a constant and
> therefore isn't a method call, so the "?" is the operator
> and should be a seperate token.


class Test
	def AMethod?
		puts "Ho Ho HO"
	end
end
a = Test.new
a.AMethod?

It _could_ be a method (maybe to be defined later), and Ruby seems to
take it as such...
If Ruby had to check whether a constant exists already or not, the
language would no longer be context-free.

-- 
 _           _                             
| |__   __ _| |_ ___ _ __ ___   __ _ _ __  
| '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ 
| |_) | (_| | |_\__ \ | | | | | (_| | | | |
|_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_|
	Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com
  
(It is an old Debian tradition to leave at least twice a year ...)
	-- Sven Rudolph