> : And "exportation"???
> 
> Exportation is just aliasing some name inside a scope to somewhere
> outside the scope.  Importatation is the same operation from the
> viewpoint of the importing scope.

I just wasn't thinking clearly when you said it the first time.

> Perl 5 didn't allow exportation of lexicals because typeglobs only
> dealt with package variables, not lexical variables.  In Perl 6
> we'll be able to alias both lexicals and package variables.  That
> implies that a lexically scoped name can be exported, whether it
> refers to a variable or something else like a property.

So a role defined in one module can be scoped lexically so as not to
trample another module's namespace, and the use()'er of that module can
elect whether ot not to export that role into his own space for
implicit use on other objects. Accordingly, if Foo implements a zippy
property, and Bar does as well, and both are polite enough about it to
make then the equivelent of EXPORT_OK, then I can say

  use Foo 'zippy';
  use Bar;
  use Baz;

  my Baz @ray = ( Baz.new() );
  $ray[0] but= zippy;

But just for the sake of clear understanding, suppose I pushed onto
@ray a whole passle of Foos and Bars and Bazzes. All the Foos and
Bazzes could use Foo's zippy. If I say

  push @ray, Bar.new();
  $ray[-1].zippy = "woohoo!";

then Bar's zippy would be used by default, right?
Now the hard question.

  my $tst = Baz.new();

How do I set a zippy property on $tst explicitly using Bar's zippy?
Is that possible? Baz has no zippy, so I'd have to use "but", right?
How about

  $tst but= Bar.zippy;  # is zippy a class property?  
  $tst but= Bar::zippy; # is zippy a class method? do I need a & ??

Or is this even possible?  

> : . . . .
> : Don't you just love the way the Greek "polymorphism" just
> : comfortably sidles up to the literal Latin "ad hoc"? :)
> : . . . .
> 
> Well, I didn't make up that particular term.  It's right out of the
> OO faq.

Oh, I know. I didn't mean to imply there was anything wrong with it.
It just struck me as funny. I have a classics degree, and I have to
take it out and walk it every now and the. :)
 
> : What I mean is (I guess) that there should only be one $o.bar, and
> : it sounds like you're saying that's not the case. Please fix my
> : bleeding brain on this one?
> 
> It means if there are two conflicting definitions of the same name,
> it's considered ambiguous where both versions of name are visible. 
> Otherwise, the name means the property that is in scope, and you
> can't see the "other" property that happens to have the same name
> elsewhere.  In other words, any time you say property "bar", it's
> really a shorthand for a longer name that may include a package name
> or lexical scope.  The aliasing of the short name to the actual name
> has to be unambiguous or it's illegal.
> 
> Larry

Ok. "it's illegal" was what I was looking for. :)


__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

Reply via email to