develooper Front page | perl.perl6.language | Postings from March 2005

Re: Parameter and trait questions - just how 'only' _is_'read-only'?

Thread Previous | Thread Next
Aaron Sherman
March 31, 2005 13:54
Re: Parameter and trait questions - just how 'only' _is_'read-only'?
Message ID:

On Thu, 2005-03-31 at 15:25, chromatic wrote:
> On Thu, 2005-03-31 at 13:11 -0500, Aaron Sherman wrote:
> I can't answer most of these well.  However...

> Open-Closed is a great idea until the most natural and easiest way to do
> something is to to redefine a little bit of the world.

You seemed to have answered my questions on the basis of a piece of
information which I asked for, but you did not include... I took the
liberty of re-reading S12 and A12 to find it, and got two answers which
are almost the same.

After having found the bit on open vs. final, I'm even more at a loss,
but I have some answers... let me start trying to put them together for
others to scrutinize (I'm not taking a pro or con position on any of
this yet, just trying to get the details worked out).

S12 sayeth:

        By default, all classes in Perl are non-final, which means you
        can derive from them.

Ok, so this answers a few of my questions. Namely, you can't do anything
particularly useful by finalizing your class (and A12 tells us you can't
really anyway). You would have to finalize EVERYTHING in your class's
inheritance chain up to, but not including it, and then close your own
class in order to allow compile-time error detection and type massaging.
Also note that A12 says:

        Likewise, a "final" class (to use the Java term) is one that you
        know will never be derived from, let alone mucked with

which subtly contradicts (or at least expands on in an unexpected way)
S12 by implying that final implies closed.... does it?

S12 then goes on to say:

        They are also open, which means you can add more methods to
        them, though you have to be explicit that that is what you're

This is far too limited, isn't it? What can we normally do to a class?
In conversations here, we've previously arm-waved that we'd be able to
do damn near anything we pleased through the metaclass... but perhaps
that's not true?

I think that's pretty much what I know and don't know as of now...
anyone want to take a shot?

Aaron Sherman <>
Senior Systems Engineer and Toolsmith
"It's the sound of a satellite saying, 'get me down!'" -Shriekback

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About