Perl::...Blocks(3pm)

πŸŽ€ Perl::Critic::Policy::ControlStructures::ProhibitUntilBlocks πŸ’…

okay so bestie, this one's a Perl::Critic policy page β€” from the Perl::...Blocks(3pm) manual, which is literally just the truncated name of the policy itself. slay. let's get into it ✨


✨ NAME ✨

Perl::Critic::Policy::ControlStructures::ProhibitUntilBlocks β€” the policy that says: write "while(! $condition)" instead of "until($condition)".

like, that's the whole vibe. no cap. 🫢


🌸 AFFILIATION 🌸

This Policy is part of the core Perl::Critic distribution. it comes pre-installed with the whole thing, iconic behavior honestly πŸ‘‘


πŸ’– DESCRIPTION πŸ’–

so Conway β€” yes, that Conway β€” discourages using until because it leads to double-negatives that are hard to understand. and like… he's right, bestie. double negatives are giving "not not un-true" energy and nobody has the brain cells for that on a Tuesday 😭

instead, you reverse the logic and use while. flip it. periodt.

until($condition)     { do_something() } #not ok
until(! $no_flag)     { do_something() } #really bad
while( ! $condition)  { do_something() } #ok

look at that second one. look at it. until(! $no_flag)?? that's #really bad, bestie, the manpage said it, not me πŸ’€

heads up: this Policy only covers the block-form of until. for the postfix variety, go see "ProhibitPostfixControls".

iykyk πŸ¦‹


🧚 CONFIGURATION 🧚

This Policy is not configurable except for the standard options. that's it. that's the section. no levers to pull, no knobs to turn, just the standard options and vibes 🌈


⭐ SEE ALSO ⭐

  • Perl::Critic::Policy::ControlStructures::ProhibitPostfixControls β€” the postfix-flavored sibling. go say hi πŸ‘‹

πŸ’œ AUTHOR πŸ’œ

Jeffrey Ryan Thalhammer <jeff@imaginative-software.com> β€” thank you for your service, king πŸ«‘πŸ‘‘


Copyright (c) 2005-2011 Imaginative Software Systems. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license can be found in the LICENSE file included with this module.

like, legally iconic. πŸ’…


okay that's the whole page, you ate that, go forth and never write until again πŸŽ€βœ¨

signing off from the perl v5.42.0 manual, dated 2024-10-23, Perl::...Blocks(3pm) β€” mwah πŸ’‹

πŸ“¦ where this page comes from