Skip to content
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

How to wrap chained short-circuiting logic operations? #82

Open
nickrobinson251 opened this issue Feb 8, 2021 · 1 comment
Open

How to wrap chained short-circuiting logic operations? #82

nickrobinson251 opened this issue Feb 8, 2021 · 1 comment
Assignees

Comments

@nickrobinson251
Copy link
Contributor

If we have code the goes over the line limit, like

if primal_name isa Symbol || Meta.isexpr(primal_name, :(.)) || Meta.isexpr(primal_name, :curly)
    # do stuff
end

How should that be wrapped?

I think our preference would be for something like this

if (
    primal_name isa Symbol ||
    Meta.isexpr(primal_name, :(.)) ||
    Meta.isexpr(primal_name, :curly)
)
    # do stuff
end

does that seem right?

@omus
Copy link
Contributor

omus commented Feb 8, 2021

Yes, that seems reasonable. I'm rather flexible on this so if you're over the line limit you could still allow multiple conditions one line and wrap it where necessary. In some cases where you are mixing && and || you may want to break it up in some other logical form

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants