I've looked before for discussion of the rationale behind
introducing attr/has and failed to find it. I noticed you
mention Zurich, so perhaps this decision followed from
discussion in living color (as against b+w).

Anyhow, what was deemed wrong with using my/our?

And...

> class Zap {
> my %.zap_cache; # a private classwide attribute
> our $.zap_count = 0; # a public classwide attribute
>
> has $.foo;
> has $.bar;
> }
>
> It may be that $.zap_count is public not so much because of the class
definition
> where it would default to private, but because $.zap_count's real
global name is
> $Zap::.zap_count.  To get a public accessor method you might still
need to declare
> it public.  And you could get a public accessor method to the "my"
variable as well
> the same way.

So:

class Zap {
  my %zap_cache;                 # var, lexical
  my %.zap_cache;                # class attr, lexical
  my %.zap_cache is public;      # class attr, lexical/public
  our $zap_count = 0;            # var, lexical/global
  our $.zap_count = 0;           # class attr, lexical/global
  our $.zap_count = 0 is public; # class attr, lexical/public/global
  has $.foo;                     # instance attr, lexical
  has $.bar is public;           # instance attr, lexical/public
}

Yes?

What about something like:

  my  $.foo;           # private instance attr
  our $.foo;           # public  instance attr

  my  $foo;            # as p5
  our $foo;            # as p5

  MY  $.foo;           # private class attr
  OUR $.foo;           # public class attr

  MY  $foo;            # invalid?
  OUR $foo;            # invalid?

      method bar;      # public  instance method
  my  method bar;      # private instance method
  our method bar;      # public  instance method
  MY  method bar;      # private class    method
  OUR method bar;      # public  class    method

--
ralph

Reply via email to