Z3.jl icon indicating copy to clipboard operation
Z3.jl copied to clipboard

Do not export `ctx`, or use different variable in the examples

Open goretkin opened this issue 3 years ago • 2 comments

Z3.ctx is a function, however the example in the README shadows it.

using Z3
ctx = Context()

This can be a problem:

julia> ctx
ctx (generic function with 2 methods)

julia> ctx = Z3.Context()
ERROR: cannot assign a value to variable Z3.ctx from module Main

goretkin avatar Nov 17 '20 19:11 goretkin

Thanks for the hint! Z3.ctx is actually a function coming from the Z3 API, and ctx is often used as a variable name. I was thinking about aliasing Z3.ctx by Z3.context and just exporting the latter. What do you think?

ahumenberger avatar Nov 18 '20 08:11 ahumenberger

I think that's a pretty decent solution.

I think, at least under some namespace, the Julia bindings should be kept as consistent as possible with the Z3 API, so that documentation for the latter can help with the former. Keeping Z3.ctx, but not exporting it, is consistent with that.

goretkin avatar Nov 18 '20 17:11 goretkin