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

Dentaku!("a OR b", a: true) raises, but probably should return true? #234

Open
vlazar opened this issue Feb 28, 2021 · 1 comment
Open

Comments

@vlazar
Copy link
Contributor

vlazar commented Feb 28, 2021

This one raises error as b was not provided.

Dentaku!("a OR b", a: true) # => Dentaku::UnboundVariableError

Semantically since a is true, the value of a OR b is true no matter what is the value ofb .

Would it make sense for Dentaku to raise Dentaku::UnboundVariableError only if a has falsy value and b is missing?

@agrberg
Copy link

agrberg commented Feb 8, 2024

The behavior above makes sense to me though my gut says it could be a little tough to implement. If you're looking for a workaround, it will function as described so as b is specify and it can be nil.

Dentaku!("a OR b", a: true, b: method_that_returns_b_or_nil) # could also use an `@ivar` to get the `nil` behavior when not set
# => true

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