Skip to content
This repository has been archived by the owner on Oct 26, 2022. It is now read-only.

eval namespaces #6

Closed
vtjnash opened this issue May 29, 2014 · 2 comments
Closed

eval namespaces #6

vtjnash opened this issue May 29, 2014 · 2 comments

Comments

@vtjnash
Copy link

vtjnash commented May 29, 2014

rather than hack in a pseudo-namespace by prefixing your variables with __, the addcomments example should just use a real namespace (module)
https://github.com/samuelcolvin/JuliaByExample/blob/master/common_usage/addcomments.jl#L20

module MyNamespace
end

eval(MyNamespace, expr)
@vtjnash
Copy link
Author

vtjnash commented May 29, 2014

(it should likely also have a try/finally, so you can ensure the STDOUT redirect is removed before returning)

@samuelcolvin
Copy link
Owner

Not sure try/catch would help. If the script being evaluated throws an except addcommnts.jl should stop and show that exception as it does not.

Slightly pedantic point for clarification: this isn't actually an example, but a utility for inserting STDOUT as comments: it's not showed on the actual site. I should probably move it to another directory to make that more clear.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants