close
Skip to content

Should without allow chaining? #63

@treyharris

Description

@treyharris

Currently, the rationale for why unless does not allow chaining is basically, "unless is exactly equivalent to if not, and unless...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, unlike with but like unless, can't have chained conditionals or an else. 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) where without is much clearer than if not defined (not to mention the subtle differences in Perl 6's vs. Perl 5's defined 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 to without, and the prohibition against chaining after unless 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 because without EXPR1 orelse EXPR2 orelse EXPR3—while admittedly useful—isn't a substitute any more than if EXPR1 or EXPR2 or EXPR3 is a substitute for elsif.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Next Resolutions MeetingThis issue will be reviewed in a future Resolutions Meeting, possibly the nextlanguageChanges to the Raku Programming Language

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions