[Kc] August 13, 2013 meeting

David Nicol davidnicol at gmail.com
Tue Aug 13 19:14:21 PDT 2013


Nobody else showed up, so I reviewed Sprout's corrections to the postfix
dereference syntax test suite.

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/kc/attachments/20130813/48ca601c/attachment.html>


More information about the kc mailing list