Use MYST_HOME environment variable for configuring load dirs.#194
Use MYST_HOME environment variable for configuring load dirs.#194faultyserver wants to merge 2 commits intomyst-lang:masterfrom
MYST_HOME environment variable for configuring load dirs.#194Conversation
The old `MYST_PATH` that allows multiple paths similar to `$PATH` has been removed in favor of `MYST_HOME`, which _should_ always point to the install location of the currently-active version of Myst. This should correspond with changes coming in `mtenv` that will set `MYST_HOME` in the shim before running `myst`. For now, users who do not use `mtenv` will have to set this manually, though we can probably check and ensure it is set as part of the VM setup.
| end.as(Array(String)) | ||
| @load_dirs ||= [ | ||
| Dir.current, | ||
| ENV["MYST_HOME"]? |
There was a problem hiding this comment.
What if MYST_HOME is empty? We just let it go? Who needs the stdlib anyways?
There was a problem hiding this comment.
I think it definitely needs more discussion. Ideally load_dirs wouldn't even live here and we could have a more authoritative place for configurable things like this (probably with dependency injection as well? for embedded versions).
|
One other thing to consider with this is that running scripts without a login shell would probably end up not setting With On manual installs, even if a user sets |
|
A myst daemon sounds like a terrible idea IMO. It'd be more like a myst demon 😛 As the primary goal of myst is to support users as best as possible, I think a strong competitor for how to set A manual installation should be done with the Makefile, any kind of other manual installation would be little, but meaningless. This is how I imagine a manual installation:
Where If not: every OS should have some way for environment variables to be set (even when not running login shells) – so worst case scenario is to force manual setting. EDIT: Although for embedded Myst, this would not be sufficient though. |
|
That sounds like a pretty solid plan to me. I certainly think it's fair to say "if you don't use |
The old
MYST_PATHthat allowed multiple paths similar to$PATHhas been removed in favor ofMYST_HOME, which should always point to the install location of the currently-active version of Myst. This is both simpler in terms of the implementation, and more intuitive to reason aboutThis should correspond with changes coming in
mtenvthat will setMYST_HOMEin the shim before runningmyst.For now, users who do not use
mtenvwill have to set this manually, though we can probably check and ensure it is set as part of the VM setup. I think this should probably emit a warning and notify the user what the VM will use in its place, since it might not always be accurate (e.g., if a user wrongly installed myst directly into/usr/local/binwithout moving the standard library as well).Perhaps a better solution would be to disallow execution if
MYST_HOMEis not set?