Comments (13)
The 'true' issue is JuliaLang/julia#1334, still open
from jump.jl.
Unfortunately not fixed after JuliaLang/julia#12544:
After a slight syntax update, dummy.jl
becomes
using JuMP
m = Model()
@setObjective(m, Max, z)
and I get
ERROR: LoadError: UndefVarError: z not defined
in include at ./boot.jl:260
in include_from_node1 at ./loading.jl:271
in process_options at ./client.jl:308
in _start at ./client.jl:411
while loading /home/mlubin/dummy.jl, in expression starting on line 584
from jump.jl.
Ouch, no luck on this yet? It's rather annoying :(
from jump.jl.
We may have to restructure the macros to take advantage of the recent improvements, but I haven't looked into it.
from jump.jl.
@ihnorton, I didn't follow all of the nuances of JuliaLang/julia#12544, but what do we have to do in JuMP to get call site line numbers reported correctly?
from jump.jl.
You want it to report UndefVarError on line 3
, correct?
Can I just do Pkg.add("JuMP")
and run your example?
To clarify, 12544 is about getting correct line numbers when generated code throws an error. If I am understanding the situation here, the error is being thrown during macro expansion, so none of the generated code is actually running yet. See the second part of my comment here about errors during macro expansion (can't throw across the flisp stack). This PR is relevant, although I think I might be able to get you UndefVarError on line 3
without it (or with a much less intrusive version -- only annotate on the flisp side).
from jump.jl.
Yes, the example should run with vanilla JuMP.
On Oct 2, 2015 5:52 PM, "Isaiah" [email protected] wrote:
You want it to report UndefVarError on line 3, correct?
Can I just do Pkg.add("JuMP") and run your example?To clarify, 12544 is about getting correct line numbers when generated
code throws an error. If I am understanding the situation here, the
error is being thrown during macro expansion, so none of the generated code
is actually running yet. See the second part of my comment here
JuliaLang/julia#8701 (comment)
about errors during macro expansion (can't throw across the flisp stack). This
PR JuliaLang/julia#13339 is relevant, although
I think I might be able to get you UndefVarError on line 3 without it (or
with a much less intrusive version -- only annotate on the flisp side).—
Reply to this email directly or view it on GitHub
#7 (comment).
from jump.jl.
@ihnorton, the error is at run time, not macro expansion.
from jump.jl.
Thanks. With the simplified example, 12544 doesn't apply because the error is being thrown by the interpreter. JuliaLang/julia#13444 should help there.
I assume you also want to use these macros inside of functions, where 12544 would apply, however, the location will still be off because I haven't figured out how to track the top-level location properly with nested locations, so right now we just default to the starting line number of the function body.
from jump.jl.
I definitely get a better backtrace when I put the code into a function:
using JuMP
function foo()
m = Model()
@setObjective(m, Max, z)
end
foo()
gives
ERROR: LoadError: UndefVarError: z not defined
[inlined code] from /home/mlubin/.julia/v0.4/JuMP/src/macros.jl:602
in foo at /home/mlubin/dummy.jl:601
in include at ./boot.jl:261
in include_from_node1 at ./loading.jl:304
in process_options at ./client.jl:308
in _start at ./client.jl:411
while loading /home/mlubin/dummy.jl, in expression starting on line 7
Though it's pointing to line 601 from dummy.jl which doesn't exist, it's macros.jl:601.
from jump.jl.
With JuliaLang/julia#13431 that should show as dummy.jl:3
. Clearly that's still off by one -- it's the function start rather than the actual line, as per my comment above -- but at least on a line that actually exists!
from jump.jl.
@ihnorton, on master I'm now getting:
ERROR: LoadError: LoadError: UndefVarError: z not defined
[inlined code] from /home/mlubin/.julia/v0.5/JuMP/src/macros.jl:584
in foo at /home/mlubin/dummy.jl:4
in include at ./boot.jl:261
in include_from_node1 at ./loading.jl:384
[inlined code] from ./operators.jl:313
in process_options at ./client.jl:277
in _start at ./client.jl:377
while loading /home/mlubin/dummy.jl, in expression starting on line 6
while loading /home/mlubin/dummy.jl, in expression starting on line -1
from jump.jl.
This seems to basically be fixed now? If we find another instance of bad backtraces we can open a new issue.
from jump.jl.
Related Issues (20)
- Multiplication of matrix expression and variables leads to stack overflow and matmul error HOT 4
- Multiple Ranges for variables HOT 3
- Y' when Y is of type ::Matrix{NonlinearExpr} HOT 1
- Poor performance in complementarity models HOT 23
- Add a method for Complex(a,b) HOT 8
- MethodError with empty summations HOT 1
- Nonlinear subexpressions HOT 4
- Should error when trying to mix `NonlinearExpression` and `GenericNonlinearExpr` HOT 1
- Support normalized_coefficient for vector-valued constraints
- Precompilation in CI fails on v1.22 HOT 7
- Fuzzy search on unrecognized keyword arguments to give suggestions HOT 2
- Track failures on nightly HOT 3
- Possibly missing diagnostics for vector of vector of variables HOT 3
- Printing of large vectorized constraints should probably cause output eliding? HOT 5
- Deleting part of containerized constraints makes whole constraint unprintable HOT 2
- function_string of Symmetric matrix includes the entire matrix HOT 7
- Inequality constraints over symmetric matrices are cumbersome HOT 9
- Set inequality syntax suggestion HOT 30
- Error when adding a constraint with a partially initialized Symmetric matrix HOT 2
- Method error in value(::Function, ::Number) HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jump.jl.