Dave Whipp wrote:
Attributes are declared with C<has>, but also have a unique signil C<$.>. So is it strictly necessary to declare them? Or rather, is it C<no strict>ly necessary -- i.e. is the following legal?

no strict;
class Foo {
  method bar {
   say $.a++
  }
}


For the standard layout, I'd think it'd be good to declare the attributes, but perhaps not necessary. An object of class C, IIRC, will just be an object in the parrot sense; doing an C<addattribute Px, Sy> will cause the attribute to be added to all other objects of that class, and to all objects that "is" or "does" that class; That might involve a whole lot of work.

But maybe you are asking if Perl6 can intuit that you implied an
unwritten C<has $.a>.... But it could be a C<has $.a> or C<our $.a> or
C<my $.a>.

BTW, should we be able to write pragmas like this:

class Foo isnt strict{...}

or

class Foo isn't strict{...}


--abhijit




Reply via email to