Johan Vromans wrote:
> 
> Hi David,
> 
> [Quoting David L. Nicol, on August 29 2000, 19:27, in "Re: RFC 132 (v3) Sub"]
> > > With the enhanced C<want> operator, subroutines can dynamically decide
> > > what to return.
> >
> > With context-based polymorphism, the decision can be made staticly.
> 
> Could you give me a quick summary of cbp? I haven't been able to
> follow all the details.
> 
> Thanks,
>         Johan



As an alternative to checking $WANT (or whatever), part of the
extended parameter list of a function indicates what contexts it
is to be used in, and the token clarifier (or whatever) chooses
the correct function from among the various ones with the same name
depending on the context in which the function call keyword appears.

Under cbp, 

        @container = myfunction($arg);  # calls the array-returning version

        $whatzis = myfunction($arg);    # calls the scalar-returning version

And even, gods willing,

        my foo $myfoo = myfunction($arg);       # calls the foo-returning version



-- 
                          David Nicol 816.235.1187 [EMAIL PROTECTED]
           Subroutine one-arg, him called no-arg, get $_-arg.  Ug.

Reply via email to