-
Notifications
You must be signed in to change notification settings - Fork 16
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
Should without
allow chaining?
#63
Comments
A couple of points raised on IRC:
The introduction of So my argument is that either removing I can find no argument for ¹ Assuming instantaneous execution and that the subordinate block has no side effects, anyway. |
One last thought for now: maximally parsimonious would be to introduce (I’d say letting |
Currently, the rationale for why
unless
does not allow chaining is basically, "unless
is exactly equivalent toif not
, andunless...elseunless...else
is confusing, so just reverse your logic if you need more than one alternative."The same logic seems to apply to
without
, which, unlikewith
but likeunless
, can't have chained conditionals or anelse
. But does the same logic actually apply?I've recently been writing top-level executables where I really have wished there was
without...orwithout...else
, because a lot of logic there is checking if conditions for execution exist (often including checking for the presence of user flags) wherewithout
is much clearer thanif not defined
(not to mention the subtle differences in Perl 6's vs. Perl 5'sdefined
are a bit of a trap here).I don't want to contribute to language bloat, but I think that cognitive load is decreased with the introduction of an
orwithout
and allowing chaining towithout
, and the prohibition against chaining afterunless
was always normative anyway—something I think we usually do in Perl with great hesitancy, and certainly not to promote hobgoblin-minded consistency.Addendum: I didn't mention
orelse
, but that's becausewithout EXPR1 orelse EXPR2 orelse EXPR3
—while admittedly useful—isn't a substitute any more thanif EXPR1 or EXPR2 or EXPR3
is a substitute forelsif
.The text was updated successfully, but these errors were encountered: