JuliaLang / Juleps

Julia Enhancement Proposals
Other
67 stars 24 forks source link

Pkg3: defaults of open vs closed #1

Closed tkelman closed 7 years ago

tkelman commented 7 years ago

Specifically with respect to

When started in interactive mode, Julia defaults to open; when started non-interactively, it defaults to closed.

So for code that depends on modules available via "open" mechanisms like LOAD_PATH, starting julia interactively and running include("script.jl") will work but julia script.jl will not?

This seems like it would be a major gotcha, I don't think interactivity is a good proxy for whether people want to be permissive about code loading or have a locked-down reproducible environment. (It is a good criteria for whether or not to enable user-prompting behavior though.)

StefanKarpinski commented 7 years ago

I had thought about making include locked down too. What criterion would make sense?

tkelman commented 7 years ago

Something that can be uniformly opted into (when desired) in either interactive mode or script mode, probably with the same default for both. It's not a very satisfying answer, but command-line flag and/or language-level API - global or scoped constructs for changing permissiveness mode? Making code loading differ between REPL and scripts by default would be a departure.

There is value to having both permissive and strict modes for code loading, but making strict the default would mean you need solid tooling to get much done. Pkg3 environments will provide that tooling, but seem like a feature that you shouldn't need to think too hard about until you're really deploying Julia code. I think that could make for more of a hurdle than the current transition from REPL code to script.

I see people write single-file modules and do push!(LOAD_PATH, pwd()) pretty often, and I don't think they'll want to worry about modifying a toml file to get that to work when run in a script.

StefanKarpinski commented 7 years ago

I guess the only time you really need strict mode to make sure you haven't used something that you didn't save in the current environment is when you're running tests, so as long as tests run in strict mode, it should be ok.