On Sunday 20 January 2002 20:57, Larry Wall wrote:
> I expect PRE and POST could inherit automatically according to the
> usual rules of DbC, though how you implement that is something other
> people have thought about more than me.  I think that LAST doesn't
> inherit.  If you want to share common code, there's this neat Perl 6
> invention called "subroutines" you can use.

Funny you should say that.  The question I hadn't asked yet:

Since these blocks are all closures now, will the different methods for 
passing code blocks be interchangeable (or simplified)?

User code code can pass '{ ... }' if a sub's prototype wants a coderef, to 
better match map and grep; sort can take a bare block or the name of a sub, 
but none of the three can take a reference to a sub.  Whereas this mostly 
makes (made) sense, can code truly start being interchangable?  Can I write 
reusable transformers and filters for map and grep, simply passing in a ref 
to the proper routine rather than the code block?  How would this interact 
(or react) with curried code blocks?

If this is a good first step, how far can it extend?  Could I write a sub, 
and pass a reference to it directly to LAST, for instance:

    LAST $coderef; 

or would I simply wrap it?

    LAST {
         &$coderef;
    }

-- 
Bryan C. Warnock
[EMAIL PROTECTED]

Reply via email to