Hi,

What is the "correct" way to do pass through args?

In perl 5 we would do:

        sub whatever {
                ...
                nested_call(@_);
                ...
        }

but slurpy args are undesireable, since they are lossy:

        data loss - shape of input parameters is indeterminate:

                sub foo ([EMAIL PROTECTED]) { ... };

                my $scalar = "Bah";
                my @array = <foo bar>;

                foo($scalar, @array); # gets <Bah foo bar>
        
        type information loss - the types signature of the callee is
        masked

A possible solution:

        sub foo will call &other { # type signature copied, lexical
        # scope of foo changed to have 'my &other = &other.assuming(...)'
                my $return = other();

                @?PARAMS; # contains a list of positionals and nameds,
                # without any flattenning, and without the shape being lost
        }

And more interestingly, for generic programming:

        sub foo (&delegate is called) {
                delegate();
        }


my &curried = foo.assuming(&some_sub);

&curried.signature; # this is already available

&foo.signature; # a code, and a yadda yadda ?

-- 
 ()  Yuval Kogman <[EMAIL PROTECTED]> 0xEBD27418  perl hacker &
 /\  kung foo master: /me sushi-spin-kicks : neeyah!!!!!!!!!!!!!!!!!!!!

Attachment: pgpOctUZwYX55.pgp
Description: PGP signature

Reply via email to