On Thu, Oct 03, 2002 at 02:29:57PM -0700, Michael Lazzaro wrote:
> One question I still have is the syntax of pre/post conditions, e.g:
> 
> >           method turn($direction, $how_sharp) {
> >                  pre  { $how_sharp <= 20 } is private;
> >                  ...implementation...
> >           }
> 
> This is obviously how it would fall out from Apocalypse 4, "pre/post" 
> being basically types of exception, but I keep having nagging concerns 
> about it.  To me, this keeps looking like "pre { ... }" is a 
> precondition attached to the _implementation_ of the given method, not 
> the _signature_ of a given method... 

I don't know, but I think it's supposed to be like this:

        # part of the signature
        method turn($dir,$ang) is pre { $ang <= 20 } {
        ...
        }

        # part of the implementation
        method turn($dir,$ang) {
            PRE { $ang <= 20 }
            ...
        }

turn() methods of derived classes would inherit the precondition in the
first case but not the second. I don't know why you'd want to do this
exactly, but it seems to me that perl should allow it.

> On Thursday, October 3, 2002, at 01:11  PM, Allison Randal wrote:
> > BTW, that's:
> >            attr $.tilt;
> > Attributes are private by default.
> 
> (As a lame aside, are we going to have a concept of "private" vs. 
> "protected" vs. "public", or just private/public?  (In other words, 
> does "private" permit access by subclasses?)  Not recommending it, just 
> wondering if anyone thinks we need it.)

I don't think we should be actively reproducing C++'s mistakes  :-)

With the constructs shown so far, I can guess that it should be
possible for someone to implement "protected" if they wanted it.

-Scott
-- 
Jonathan Scott Duff
[EMAIL PROTECTED]

Reply via email to