On Mon, Feb 01, 2010 at 05:56:09PM +0100, Jan Ingvoldstad wrote:
> On Mon, Feb 1, 2010 at 17:46, Patrick R. Michaud <pmich...@pobox.com> wrote:
> > There's a third way:
> >
> >    class B { ... }    # introduce B as a class name without definition
> >     class A { sub foo { B::bar } }
> >
> >    class B { sub bar { A::foo } }
> 
> It seems to me that this doesn't really solve the problems that will occur
> when people start making packages independently of eachother.
> 
> Of course it can be solved by submitting patches to the other developer's
> code, but it seems inelegant.

I see it as not being much different that what already happens now
in most languages I deal with.

Assume the above lines of code are in different files -- one for A
and one for B.  Presumably A has a reason for saying "class B { ... }"  
instead of the more likely "use B;" -- i.e., the author of A knows 
that it is using B, and that B is likely to refer back to A.

And in the above example, I'd expect the file containing the definition
of B to likewise have either a "use A;" or "class A { ... }"
declaration.

It ultimately comes down to the fact that Perl expects each module
to declare class names before they get used, unless the class
names are part of CORE.

Pm

Reply via email to