[opam-devel] Multiple names for the same switch (aliases that are really aliases)

Louis Gesbert meta at antislash.info
Thu Jan 5 08:01:06 GMT 2017


Well, the thing is, switch names in 1.2 where loosely bound to the 
compiler names (unless you used --alias-of, that is); in 2.0, the switch 
name is just its handle, and, as far as opam is concerned, has no 
relationship with what is actually within the switch. This is reflected 
in the new syntax:

     opam switch create <name> <compiler>

You can abbreviate to have <name> and <compiler> be the same, but that's 
it. So it seems difficult to me to add semantics on top of this naming. 
It could be possible to index existing switches based on their installed 
compiler-packages and have a way to select based on that, though, but I 
am not sure that would add more convenience than confusion.

As pointed out by David, though, you can be much more flexible in the 
compilers that can be selected at switch creation.

Something that what requested but didn't make it is the ability to 
rename switches. A bit trivial, but this is due to both the naming of 
the switch directory being based on its name, and ocaml not being 
relocatable.

Best,
Louis

Le 2016-12-30 18:06, Gabriel Scherer a écrit :
> Hi opam-devel,
> 
> A few weeks ago I discussed with Jeremy Yallop the idea of having
> switches for major OCaml versions (4.01, 4.02, 4.03...) that would
> point to the currently-best minor version of them (do you remember?
> 4.01.0, 4.02.3, 4.03.1).
> 
> I would be willing to invest the effort of doing that and maintaining
> this mapping, but I feel that just creating new switches is too
> heavy-handed to be useful. If I already have a 4.02.3 switch, I would
> like "opam switch 4.02" to bring me to that switch, not install a new,
> distinct one with name 4.02 that would in fact install the same
> compiler as 4.02.3.
> 
> Do I correctly understand that this feature is not possible in OPAM
> 1.2.x? (If it is, I may do it.)
> Is it possible in 2.x?
> 
> (Louis: I do distinctly remember your call to try out 2.x at ICFP and
> I feel guilty about not having done much yet. Apologies.)
> 
> _______________________________________________
> opam-devel mailing list
> opam-devel at lists.ocaml.org
> http://lists.ocaml.org/listinfo/opam-devel


More information about the opam-devel mailing list