> From: Thom Boyer <[EMAIL PROTECTED]>
> Date: Fri, 10 Jan 2003 13:57:26 -0700
> 
> From: Michael Lazzaro [mailto:[EMAIL PROTECTED]]
> > But I don't know if these two 
> > lines would really have the same result, ...
> >
> >      $a = MyScalar;
> >      $a = 'MyScalar';
> 
> Hrmm. Didn't Larry decree that there are no bare words, but that a class
> name will evaluate to the string representing the spelling of the class
> name? In otherwords, aren't those two assignments identical by definition?

You're correct in that there are no barewords.  But, IIRC, a class
name doesn't just evaluate to a string representing the spelling of
the class name.  Classes are first-class objects in Perl 6, just as
subroutines were in Perl 5.

The two variables would only behave the same in certain situations
because of symbolic dereferencing.  But, they couldn't go by name,
because then what would $foo be here:

   $foo = class { has $.bar is public };

As far as the example:

   $a = MyScalar;
   $b = $a is $a;

(Or something like that)  I would imagine that would only work if $a
was known at compile time:

   BEGIN { $a = MyScalar; }
   $b = $a is $a;

Maybe.  Actually, that's quite a difficult question; is MyScalar a
property or a behavior class?  Is there a difference, or is the latter
a subset of the former?

But, AFAIK, the two statements are not equivalent.

Luke

Reply via email to