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

julia 1.6 beta #72

Closed
mdpetters opened this issue Jan 10, 2021 · 4 comments
Closed

julia 1.6 beta #72

mdpetters opened this issue Jan 10, 2021 · 4 comments

Comments

@mdpetters
Copy link

Testing some of my code with julia 1.6-beta throws an error with the @memoize macro. It's an unusual case with an easy workaround. I am reporting it here because it suggests that something changed under the hood, which might break other use cases as well.

This construct works fine in julia 1.5.3

using Memoize, Lazy
@memoize foo(x) = @> x exp sin println
foo(2)

which evaluates to 0.8938. In julia 1.6

using Memoize, Lazy
@memoize foo(x) = @> x exp sin println

throws: @memoize must be applied to a method definition

The @as threading macro from Lazy.jl does work as expected, so it can be used as an easy workaround.

using Memoize, Lazy
@memoize foo(x) = @as x exp(x) sin(x) println(x)

P.S. Tested with Lazy v0.15.1 and Memoize v0.4.4

@cstjean
Copy link
Collaborator

cstjean commented Jan 10, 2021

What if you try @memoize foo(x) = @>(x, exp, sin, println)?

@memoize must be applied to a method definition means that it's almost certainly either a MacroTools bug, or a Julia bug. It'd be interesting to figure out what changed.

@cstjean
Copy link
Collaborator

cstjean commented Jan 10, 2021

Ouch,

julia> :(@> 1 2)
:(#= REPL[8]:1 =# @Error showing value of type Expr:
ERROR: MethodError: no method matching is_syntactic_operator(::String)
Closest candidates are:
  is_syntactic_operator(::Symbol) at show.jl:1221
Stacktrace:
  [1] is_valid_identifier
    @ ./show.jl:1399 [inlined]
  [2] show_sym(io::IOContext{Base.TTY}, sym::String; allow_macroname::Bool)
    @ Base ./show.jl:1438

That sounds like something a bug that should be filed in julialang.

@cstjean
Copy link
Collaborator

cstjean commented Jan 10, 2021

It's JuliaLang/julia#39156, but somehow I don't think this will solve the whole problem. Let's wait for the next release...

@mdpetters
Copy link
Author

Fixed in v1.6.0-rc1.

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