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

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

Thread Previous | Thread Next
Father Chrysostomos
June 16, 2013 14:13
Re: key/value hash and index/valuse array slices syntax
Message ID:
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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About