Abigail wrote: > > Having said that, I don't think the added convenience for just exists > outweigths the drawback of added complexity to the language. Perhaps > if Perl had next to truth/defined/exists a handful of similar notions > that could have been dealt with in one consistent fashion that this > patch would be useful. > > Having said that, I must say that I find that Roy's proposal has some > interesting ideas. I found Roy's original proposal in c.l.p.misc more interesting that his second (extended) one : basically, this was to allow the return value of defined() and exists() to be used in a lvalue context with ||= and &&=. Id est : defined($foo) ||= 'default'; means $foo //= 'default'; and exists($hash{key}) &&= 'replacement'; means if (exists($hash{key})) { $hash{key} = 'replacement' } If we keep only this idea, this is only an extension to existing syntax, backwards-compatible. The only sane way to implement this is probably with a bunch of optree rewriting at optimization time. This means that it's probably possible to implement it with Arthur's optimizer.pm. And to put it on CPAN and to avoid bloating the core and to port it to older perls ! yoohoo ! (any takers?)Thread Previous | Thread Next