develooper Front page | perl.perl5.porters | Postings from July 2012

Re: Smartmatch two cents (was... List::Util... when...)

Thread Previous | Thread Next
From:
Ricardo Signes
Date:
July 5, 2012 19:47
Subject:
Re: Smartmatch two cents (was... List::Util... when...)
Message ID:
20120706024729.GC20266@cancer.codesimply.com
* Ed Avis <eda@waniasset.com> [2012-07-03T04:59:34]
> As in Python, 'in' could work for both arrays and hashes:
> 
>    $x in @array
> 
>    $x in %hash    # same as exists $hash{$x}

Alas, Perl is not Python, and alas, Python is not Perl.  The "in" operator in
Python works nicely because Python's type system is different to Perl's.

We're not going to be adding an `in` operator, because it goes against the
idea of where Perl decides what type to use.  Fortunately, Perl6::Junction and
other libraries provide excellent tools for doing this kind of scanning.  I use
them all the time and don't regret it for a second.

-- 
rjbs

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