----- Original Message ---- > From: Patrick R. Michaud <pmich...@pobox.com> > > I would expect this to be roughly equivalent to: > > > > for @array { $_ .= trim; } > > > > For an array of hashes, this would result in each hash element > > of @array being replaced with a reference to an array of the > > trimmed string representation of the hash. > > Oops -- I over-referenced here. The corrected form: > > For C< @array».=trim >, each element of @array would be replaced > with its trimmed string representation. If @array starts out > as an array of hashes, then @array».=trim would leave @array > with the trimmed stringification of each hash element.
I don't get this. If I can't call @array.trim, I certainly can't call %hash.trim. If you mean stringify the hash and then trim *that*, what does that mean? We get that all the time in Perl 5 and I've written tests to catch things like HASH(0x80631d0) showing up in templates. This is probably some of the most useless behavior in Perl 5 and I don't want to see it propagate to Perl 6. Either that should die violently or it should do something useful and I'm unsure of what would be useful here. A hash is basically a set of pairs. You *can't* trim the keys because they're supposed to be unique. Otherwise, what does it mean to trim { ' foo' => 1, 'foo ' => 2 }? So we can only trim values, but what if the values are pairs? Then wouldn't you effectively be apply the hyperop recursively throughout the data structure? That might be expensive and have unwanted side-effects ("what do you mean my hash had a reference to your ORM data?"). Cheers, Ovid -- Buy the book - http://www.oreilly.com/catalog/perlhks/ Tech blog - http://use.perl.org/~Ovid/journal/ Twitter - http://twitter.com/OvidPerl Official Perl 6 Wiki - http://www.perlfoundation.org/perl6