OPAMSWITCH appears undocumented, though it's referred to in the man page under opam --switch ("This is equivalent to setting $OPAMSWITCH")

My question is, if I set OPAMSWITCH, will I then be able to run regular (non-opam) ocaml build commands in the local shell in the given compiler, while running commands in a different shell with a different compiler? If not, is such a feature planned?

-Yotam

On Thu, Sep 18, 2014 at 5:24 PM, Anil Madhavapeddy <anil@recoil.org> wrote:
On 18 Sep 2014, at 22:20, Yotam Barnoy <yotambarnoy@gmail.com> wrote:

> I have a question about opam. I would like to play with certain compiler versions, but I don't want the switch to happen globally, because I still need to compile regular code. Is it possible to switch to another compiler locally (within a particular shell session) via environment variables, while using my regular compiler in another shell session?
>
> If this is the way things work already, I apologize in advance -- it appeared to me that running opam switch modifies some global state that directly affects other pre-existing shell sessions.

It's worth reading the man page for OPAM ("man opam" or "opam --help"), which lists all the environment variables and command-line options available.

There is OPAMSWITCH (or the command line --switch option) which will fix a particular switch to run the opam command set in.

best,
Anil