New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chained comparison #16317
Comments
From zefram@fysh.orgCreated by zefram@fysh.orgIt would be nice for Perl to understand chained comparisons such as "$a One wrinkle: we currently have two levels of precedence for comparison Perl Info
|
From @demerphqI so look forward to this, both as a patch i can learn from and as a Yves On 19 Dec 2017 7:38 am, "Zefram" <perlbug-followup@perl.org> wrote:
|
The RT System itself - Status changed from 'new' to 'open' |
From @leonerdOn Tue, 19 Dec 2017 09:10:57 +0100
+1 I'd be happy to accept some new warnings, in exchange for being able to grep { $min <= $_ <= $max } @numbers -- leonerd@leonerd.org.uk | https://metacpan.org/author/PEVANS |
From @davidnicolhow would this be done without looking ahead more than one parse-time Perhaps a "Comparison Expression" type would be introduced to the grammar. Expressions in the middle should only get evaluated once, and later ones $min <= &lookup1 < &lookup2 <= $max should be equivalent to do { my $tmp1 = &lookup1; $min <= $tmp1 and do { my $tmp2 = rather than the double-calling ( $min <= &lookup1 and &lookup1 < &lookup2 and &lookup2 <= $max ) for any expression &lookupN more complicated than an unblessed scalar. I think I'm willing to write a test case for this if it would help. On Wed, Dec 20, 2017 at 10:39 AM, Paul "LeoNerd" Evans <
-- |
This feature was implemented in perl 5.32, see 02b85d3 and the corresponding perldelta entry. |
Migrated from rt.perl.org#132607 (status was 'open')
Searchable as RT132607$
The text was updated successfully, but these errors were encountered: