From:

Date:

July 27, 2021 23:35Subject:

Elevator pitch - "assuming"Message ID:

CAO-W_8A6XGcWGTheRo741UUB9Ld0nvtM986Ez+CX=o7ohkkGdQ@mail.gmail.comI frequently find myself writing lines of code like the following $row->{nested}{key} = mutate_it($row->{nested}{key}) if $row->{nested}{key} And I find it annoying that I have to keep repeating the name of the variable. The line processes a value if it's truthy, and leaving it falsy otherwise. it would be nice if we had a conditional statement that would also topicalize, so that it could be cut down to $_ = mutate_it($_) assuming $row->{nested}{key} Open questions that come to mind is what conditions other than truthiness would look like. Something like assuming $row->{nested}{key} : exists $_ perhaps? In terms of what the argument to assuming would be, I guess any lvalue would make sense. Existing options: There is a &&= operator, but it would still require duplication of lengthy unravelings.Thread Next

**Elevator pitch - "assuming"**by Veesh Goldman- Re: Elevator pitch - "assuming" by David Nicol
- Re: Elevator pitch - "assuming" by sisyphus
- Re: Elevator pitch - "assuming" by Smylers
- Re: Elevator pitch - "assuming" by Paul "LeoNerd" Evans
- Re: Elevator pitch - "assuming" by Smylers
- Re: Elevator pitch - "assuming" by Paul "LeoNerd" Evans
- Re: Elevator pitch - "assuming" by Paul "LeoNerd" Evans
- Re: Elevator pitch - "assuming" by Oodler 577 via perl5-porters
- Re: Elevator pitch - "assuming" by Paul "LeoNerd" Evans
- Re: Elevator pitch - "assuming" by Darren Duncan
- Re: Elevator pitch - "assuming" by Eirik Berg Hanssen
- Re: Elevator pitch - "assuming" by Martijn Lievaart
- Re: Elevator pitch - "assuming" by Tom Molesworth via perl5-porters
- Re: Elevator pitch - "assuming" by Martijn Lievaart
- Re: Elevator pitch - "assuming" by Veesh Goldman
- Re: Elevator pitch - "assuming" by Felipe Gasper
- Re: Elevator pitch - "assuming" by Mark Gardner
- Re: Elevator pitch - "assuming" by Tony Cook
- Re: Elevator pitch - "assuming" by Mark Gardner
- Re: Elevator pitch - "assuming" by Mark Gardner
- Re: Elevator pitch - "assuming" by Martijn Lievaart
- Re: Elevator pitch - "assuming" by Eirik Berg Hanssen

nntp.perl.org: Perl Programming lists via nntp and http.

Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About