unary +@ can't be defined for Symbol?

T

T. Onoma

class Symbol
def -@
[ self ]
end
def +@
[ self ]
end
end
p -:a # => [ :a ]
p +:a # => :a

What's the problem here?

T.
 
K

Kent Dahl

T. Onoma said:
class Symbol
def -@
[ self ]
end
def +@
[ self ]
end
end
p -:a # => [ :a ]
p +:a # => :a

What's the problem here?

Problem parsing plus and colon probably. I noticed that:
p(+:)a)) #=> [:a]
which does decidedly look bad. No problem when the symbol is stored in
another value, as:
x = :a
p +x #=> [:a]
 
T

T. Onoma

Problem parsing plus and colon probably. I noticed that:
p(+:)a)) #=> [:a]
which does decidedly look bad. No problem when the symbol is stored in
another value, as:
x = :a
p +x #=> [:a]

Thanks, Kent.

I hope it can be fixed. Kind of puts a big damper on what I'm working on.

T.
 

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

Forum statistics

Threads
474,142
Messages
2,570,818
Members
47,362
Latest member
eitamoro

Latest Threads

Top