Error: `@compat` called with wrong number of arguments

Appveyor gets the following error from Compat 0.25.2 on Julia 0.5.2:

ERROR: LoadError: LoadError: syntax: unhandled expr (error #<julia: Base.ArgumentError(msg="@compat called with wrong number of arguments: (:struct,:(MXError <: Exception))")>)
 in include_from_node1(::String) at .\loading.jl:488 (repeats 2 times)
 in macro expansion; at .\none:2 [inlined]
 in anonymous at .\<missing>:?
 in eval(::Module, ::Any) at .\boot.jl:234
 in process_options(::Base.JLOptions) at .\client.jl:242
 in _start() at .\client.jl:321
while loading C:\Users\appveyor\.julia\v0.5\MXNet\src\base.jl, in expression starting on line 1
while loading C:\Users\appveyor\.julia\v0.5\MXNet\src\MXNet.jl, in expression starting on line 24
ERROR: LoadError: Failed to precompile MXNet to C:\Users\appveyor\.julia\lib\v0.5\MXNet.ji.
 in compilecache(::String) at .\loading.jl:593
 in require(::Symbol) at .\loading.jl:422
 in include_from_node1(::String) at .\loading.jl:488
 in process_options(::Base.JLOptions) at .\client.jl:265
 in _start() at .\client.jl:321
while loading C:\Users\appveyor\.julia\v0.5\MXNet\test\runtests.jl, in expression starting on line 1

When I test locally on 0.6 I get no errors. I suppose this is not too surprising since Compat probably sees that it is on 0.6 and doesn’t get called. I guess my question is, is it even possible to use @compat on struct, and, if so, what’s causing this error?

No.

Does this mean all structs have to be reverted to type? What about mutable struct?

This seems non-ideal as it will have everybody sticking with type and immuatble until 0.7.

Syntax changes are hard. This was the best we could do. In 0.7, the old syntaxes will be deprecated, so you can run your code on 0.7 and get feedback on what to change. You should then immediately switch to 1.0 – released at the same time – where the old syntax will simply be an error.

1 Like

Well, my philosophy is usually “update your shit”, so, especially considering Julia is pre-1.0, I’d be perfectly happy to just use 0.6 and not use Compat at all, but I doubt I can persuade everyone to have the same attitude. Thanks.

If you’re supporting 0.6, you basically have to use the old syntax, which I agree is unfortunate, but it’s only for a limited time. Once 1.0 is out, we encourage dropping support for older Julias entirely and focusing exclusively on moving to 1.0 for all code bases.

2 Likes