in reply to Re: Re: Re: What should be returned in scalar context?
in thread What should be returned in scalar context?

I haven't thought through how this would be done, but one way might be to return 'SCALAR/STRING' and 'SCALAR/NUMERIC' respectively in the case of your two if statements.

Sounds like a good use of junctions:

if( want() eq all( 'SCALAR', 'STRING' ) ) { . . . }

----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer

: () { :|:& };:

Note: All code is untested, unless otherwise stated

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: What should be returned in scalar context?
by BrowserUk (Patriarch) on Dec 02, 2003 at 22:50 UTC

    That has possibilities, though I think I would prefer to pass the junction in to want() and have it return a boolean in the boolean context than have it pass back a junction and then compare that junction against another?

    Of course, once we get the select/when construct, it probably makes more sense and will be more efficient to not pass the parameter to want(), and have it return the junction to the select and code the variations as when clauses.


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail
    Hooray!
    Wanted!