We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
_ && true
julia> @o (_ && true) ERROR: LoadError: ArgumentError: Cannot parse optic _ && true. Lens expressions must start with _, got $(Expr(:escape, :(_ && true))) instead.
What's happening here?
The text was updated successfully, but these errors were encountered:
Note that it works with &:
&
julia> using Accessors julia> @o _ & true (::Base.Fix2{typeof(&), Bool}) (generic function with 1 method)
On the other hand && is not a function, but has special short-circuit semantics.
&&
julia> dump(:(_ && true)) Expr head: Symbol && args: Array{Any}((2,)) 1: Symbol _ 2: Bool true julia> dump(:(_ & true)) Expr head: Symbol call args: Array{Any}((3,)) 1: Symbol & 2: Symbol _ 3: Bool true
I think we could in improve the error message, but I don't think we should produce an optic from this.
Sorry, something went wrong.
improve an error #160
be138a0
Btw, this kind of stuff works with AccessorsExtra – not with constants like true but with actual functions on each side:
true
julia> using AccessorsExtra julia> @o _.a && _.b (@o _.a) ⩓ (@o _.b)
Successfully merging a pull request may close this issue.
What's happening here?
The text was updated successfully, but these errors were encountered: