develooper Front page | perl.perl5.porters | Postings from June 2013

Re: key/value hash and index/valuse array slices syntax

Thread Previous | Thread Next
From:
Father Chrysostomos
Date:
June 16, 2013 14:13
Subject:
Re: key/value hash and index/valuse array slices syntax
Message ID:
20130616141336.27469.qmail@lists-nntp.develooper.com
Ruslan Zakirov wrote:
> A quick review of the code [2] would be helpful too.

I have not had a chance to build your branch yet.

I do not think allowing %h{a,b} = ... is a good idea, for the same
reason that "$a$b" = ... is disallowed.  They both return modifiable
temporary values, so let people modify them through for (%h{a,b}), but
disallow %h{a,b}, because it could too easily lead to bugs.  I think you
have implemented it the way I want it.

Another thing I notice is the use of LVRET in pp_kvhslice.  LVRET returns
false unless the operator has the OPpMAYBE_LVSUB flag set, which needs to
be done in op_lvalue_flags.  That will be necessary for
+sub:lvalue{%h{a}}->() = (undef,"value") to work.


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About