[pm-h] Interesting Blog Posts on Context & Array vs List

Mark Allen mrallen1 at yahoo.com
Fri Feb 21 08:13:02 PST 2014


I think it's a pretty great 1st start.  And you *can* have a slurpy arg in the final position. Plus everything's still in @_ if you want to be traditional or modify stuff using topic variables.



On Friday, February 21, 2014 9:05 AM, B. Estrade <estrabd at gmail.com> wrote:
 
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 <uri at stemsystems.com> wrote:

On 02/21/2014 08:13 AM, B. Estrade wrote:
>
>On Wed, Feb 19, 2014 at 2:35 PM, Mark Allen <mrallen1 at yahoo.com> 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, at b, at c, at 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
>Houston at pm.org
>http://mail.pm.org/mailman/listinfo/houston
>Website: http://houston.pm.org/
>


_______________________________________________
Houston mailing list
Houston at pm.org
http://mail.pm.org/mailman/listinfo/houston
Website: http://houston.pm.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/mailman/private/houston/attachments/20140221/9c042fae/attachment.html>


More information about the Houston mailing list