[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Parser bug?

Logan Capaldo

10/2/2006 11:14:00 PM

So I was playing around, and decided that I wanted to define a method
that ended in ?, but also happened to not have anything but an ending,
<g>.

So I did this:

def ?()
end

I got a syntax error, not very surprising. The interesting bit was
_what_ syntax error I got:

% ruby <<HERE
heredoc> def ?()
heredoc> end
heredoc> HERE
-:1: parse error, unexpected tINTEGER
def ?()
^

Obviously a ')' is not an integer token. Thoughts? Comments? Insults? Is
this really a bug?

2 Answers

Marcin Mielzynski

10/2/2006 11:24:00 PM

0



the ? operator takes an ascii symbol and returns numerical value for it
(namely integer)

lopex

Marcin Mielzynski

10/2/2006 11:26:00 PM

0

Marcin MielżyÅ?ski wrote:
>
>
> the ? operator takes an ascii symbol and returns numerical value for it
> (namely integer)
>

at parse time of course...

lopex