Parser bug?

L

Logan Capaldo

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?
 
M

Marcin Mielżyński

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

lopex
 
M

Marcin Mielżyński

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

at parse time of course...

lopex
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,214
Messages
2,571,112
Members
47,704
Latest member
DavidSuita

Latest Threads

Top