On Thursday, August 14, 2003, 4:39:06 PM, nobu wrote:

> Hi,

> At Wed, 13 Aug 2003 21:02:23 +0900,
> Papp Zoltan wrote:
>> > I predict this will work:
>> >
>> >   module A; end
>> >
>> >   module A::B
>> >     def A::B.hello()
>> >     end
>> >   end
>> 
>> Of course I've tried it, too. But it's a syntax error.

>     def (A::B).hello()
>     end

> Singleton receiver must be a variable or a parenthesized
> arbitrary expression.

Hmmm, that's a bit odd.

  irb(main):005:0> def ("x").foo
  irb(main):006:1> end
  SyntaxError: compile error
  (irb):5: can't define single method for literals
  def ("x").foo
           ^
          from (irb):6
  irb(main):007:0> def ("x" + "y").foo
  irb(main):008:1> end
  => nil

Not so "arbitrary" after all.

Gavin