[Kc] August 13, 2013 meeting

David Nicol davidnicol at gmail.com
Tue Aug 13 19:25:16 PDT 2013


There is also $cr->&*, which works like $cr->(@_), possibly without
creating a new stack frame, like goto &$cr. Otherwise I don't understand
its necessity.


On Tue, Aug 13, 2013 at 9:14 PM, David Nicol <davidnicol at gmail.com> wrote:

> Postfix dereferencing may be available in 5.20.
>
> Postfix dereferencing means, instead of putting the sygil on the left side
> of a name or a scalar holding a reference, you put it on the right end like
> a method call.
>
> There are six new postfix dereferencing operators, along with the postfix
> method calls and scalar container member extraction we've had forever.
>
> Pre-existing postfix dereferencing syntax:
>   $obj->METHODNAME  send a METHODNAME invocation message to $obj
>   $obj->METHODNAME(...)  send a METHODNAME invocation message to $obj,
> with args
>   $ar->[N]              look up an element in an array, like $$ar[N]
>   $hr->{STRING}   look up a value in a hash, like $$hr{STRING}
>   $cr->(...)             run the code in a code reference with ... as
> arguments
>
> New postfix dereferencing syntax:
>   $sr->$*               dereference a reference to a scalar, like $$sr
>   $ar->@*             dereference a reference to an array, like @$ar
>   $ar->@[...]         array reference slice, like @$ar[...]
>   $hr->@{...}         hash reference slice, like @$hr{...}
>   $gr->**                dereference a reference to a typeglob, like *$gr
>   $gr->*{...}            access a slot in a typeglob reference, like
> *$gr{...}
>
>
> As arrow binds tighter than the \ take-a-reference operator, taking
> references remains prefix only.
>
>
> --
> You've got to wiggle before you can crawl
>



-- 
You've got to wiggle before you can crawl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/kc/attachments/20130813/18a34855/attachment.html>


More information about the kc mailing list