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

Type error inconsistency (non-booleans used in boolean contexts) #3322

Closed
zachallaun opened this issue Jun 7, 2013 · 2 comments
Closed

Type error inconsistency (non-booleans used in boolean contexts) #3322

zachallaun opened this issue Jun 7, 2013 · 2 comments

Comments

@zachallaun
Copy link
Contributor

I've run into some strange behavior while trying to define |> as a pipe operator. Yes, yes, I know that | works perfectly well, but |> is more pleasing to my eye, so bear with me. 😇

julia> double(x) = x*2

julia> |>(val, f) = f(val)

julia> 5 |> double
10

julia> (5
       |> double
       |> double)
ERROR: type: non-boolean (Int64) used in boolean context

# Both parse as a :comparison
julia> :(5 |> double).head
:comparison

julia> :(5 |> double |> double).head
:comparison

Perhaps neither of these should be possible and both should be a type error, but this outcome seems unlikely to be intended.

@JeffBezanson
Copy link
Sponsor Member

Sorry, I didn't intend |> to parse as a comparison.

@zachallaun
Copy link
Contributor Author

You're awesome.

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