Skip to content

and / or keywords with raise / fail #415

Closed
@smanolloff

Description

@smanolloff

The idea of banning the and & or keywords is really cool.

However, there is one specific case in which they may be preferred:

authenticate_user! || fail AuthenticationFailure, 'Invalid credentials'
# SyntaxError: unexpected '\n', expecting :: or '[' or '.'

authenticate_user! or fail AuthenticationFailure, 'Invalid credentials'
# (this works ok)

Of course, we we could just use

fail AuthenticationFailure, 'Invalid credentials' unless authenticate_user!

... but doesn't it degrade readability?

Is the usage of and or or, immediately followed by a raise or fail, justified?
I would be happy if you could share your thoughts!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions