So I guess with the signatures, the answer is "it depends" since it'll work
with signatures as one might expect (i.e., the flattened array would have
to have each element correspond to a sig parameter) or the sig parameter
may very well be data type passed by reference.

I read up on the signature thing, and I doubt I'll find it useful for
anything. It's also experimental, so requires an explicit feature 'use' and
can be taken out at any time.

http://search.cpan.org/~tonyc/perl-5.19.9/pod/perlsub.pod#Signatures

It seems a squishy and a little general, maybe it'd be better if one could
specific the Perl data type (scalar, hashref, arrayref, etc) via the
signature definition.

Brett


On Fri, Feb 21, 2014 at 8:03 AM, Uri Guttman <[email protected]> wrote:

> On 02/21/2014 08:13 AM, B. Estrade wrote:
>
>> On Wed, Feb 19, 2014 at 2:35 PM, Mark Allen <[email protected]> wrote:
>>
>>  When subroutine signatures are released in 5.20, you'll be able to do
>>>
>>> sub foo ($self, $foo, $bar, $baz) {
>>>     $foo ||= 'default';
>>>     $baz //= 0;
>>>
>>>     ...;
>>> }
>>>
>>> Yay!
>>>
>>>
>>
>> How will this behave if you call the method with foo(@a,@b,@c,@d) versus
>> foo(\@a,\@b,\@c,\@d) ?  Does list flattening still occur in this case
>> necessitating the use array references if you want to pass one array per
>> parameter?
>>
>>
> sub calls always flatten into @_. the only way to pass individual arrays
> is by reference. prototypes (not recommended in most cases) do allow arrays
> to be parsed as single args but they are actually passed as references.
>
>
> uri
>
>
> --
> Uri Guttman - The Perl Hunter
> The Best Perl Jobs, The Best Perl Hackers
> http://PerlHunter.com
> _______________________________________________
> Houston mailing list
> [email protected]
> http://mail.pm.org/mailman/listinfo/houston
> Website: http://houston.pm.org/
>
_______________________________________________
Houston mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/houston
Website: http://houston.pm.org/

Reply via email to