Larry Wall skribis 2005-04-14 10:11 (-0700):
> Interestingly, if .{} defaulted to smart matching, ordinary .{'foo'}
> would essentially fall out of the samantics of "find me all the keys
> that smartmatch "foo", which is only one of them, presuming a hash
> that guarantees uniqueness.  One could view .{} as Perl's version of
> SQL's "select".

    @foos = %hash{ /^foo_/ } ».value;

Wow. I love that.

    %handles{IO::Socket}

Nice.

But the best thing about this is that it makes junctions more
meaningful:

    %hash{'foo' | 'bar' | 'baz'}

I think meant

    %hash<foo> | %hash<bar> | %hash<baz>

But indeed, SELECTing with ~~ is more useful:

    %hash{ IO::Socket | IO::File | 'foo' }
    %hash{ grep { %hash{$_}.does(IO::Socket|IO::File) || exists %hash{$_} }, 
%hash.keys }

So, what's the important downside of all this?


Juerd
-- 
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html 
http://convolution.nl/gajigu_juerd_n.html

Reply via email to