You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After upgrading to 5.1.1, I stumbled on the problem mentioned in #11979 : my ocamlinit was using Topdirs before #use "topfind".
This led me to realise that the Topdirs module I had been using to do things like let _ = Topdirs.dir_directory ("K:\\Applications_INFO\\OCaml\\supports\\" ^ Sys.ocaml_version) (very useful to provide to students in a lab where, unfortunately, not all computers have the same exact version of OCaml) is not "officially" available to users and subject to change.
However, I believe that using Topdirs functions (and so on) is better than using the toplevel directives that they implement :
they are more powerful (it is not possible to use a variable in a #directory, for example) ;
they do not require introducing a special syntax to new users, especially the dreaded ;;, and therefore also avoid confusions.
Since I understand the need for Topdirs and others to remain tweakable by the OCaml team, I suggest that in addition to the traditional #directive syntax (for the sake of compatibility), a new, user-faced OCaml module be added to the standard library as an interface, say Directives or Toplevel, and be the preferred way to manipulate the toplevel in the OCaml manual.
This would also allow to maintain conceptual compatibility with existing directives : eg. Topdirs.dir_load is not a drop-in replacement for #load, because one needs to say eg. Topdirs.dir_load Format.std_formatter somefile, but we could have a Directives.load that would behave exactly like #load.
The text was updated successfully, but these errors were encountered:
After upgrading to 5.1.1, I stumbled on the problem mentioned in #11979 : my ocamlinit was using
Topdirs
before#use "topfind"
.This led me to realise that the
Topdirs
module I had been using to do things likelet _ = Topdirs.dir_directory ("K:\\Applications_INFO\\OCaml\\supports\\" ^ Sys.ocaml_version)
(very useful to provide to students in a lab where, unfortunately, not all computers have the same exact version of OCaml) is not "officially" available to users and subject to change.However, I believe that using
Topdirs
functions (and so on) is better than using the toplevel directives that they implement :#directory
, for example) ;;;
, and therefore also avoid confusions.Since I understand the need for
Topdirs
and others to remain tweakable by the OCaml team, I suggest that in addition to the traditional#directive
syntax (for the sake of compatibility), a new, user-faced OCaml module be added to the standard library as an interface, sayDirectives
orToplevel
, and be the preferred way to manipulate the toplevel in the OCaml manual.This would also allow to maintain conceptual compatibility with existing directives : eg.
Topdirs.dir_load
is not a drop-in replacement for#load
, because one needs to say eg.Topdirs.dir_load Format.std_formatter somefile
, but we could have aDirectives.load
that would behave exactly like#load
.The text was updated successfully, but these errors were encountered: