>> Local imports might be useful, though.  Objective Caml 2.00 has finally
>> caved in and followed Standard ML in allowing expression-local modules.
>
>Standard ML does not allow this. One important aspect of the SML module
>system actually is its strong separation from the core language.

Not that old saw again...!  Ocaml separates the two as well.

You're right, though.  I meant expression-local imports, like

  local open M
  in ...

What Ocaml allows now is things like

  let f x y =
    let module M = struct ... y ... end
    in ... M.y ...

No first-class doohickeys allowed, so it's really not that far from SML.  I imagine 
that it could be translated into SML along these lines (excuse my rusty SML):

  structure M = struct ... val y = ref <something> ... end;
  structure X =
    struct
      fun f(x,y) = M.y := y; ... !M.y ...
    end;

Or maybe not.  I'm not sure of the extent of the feature, but I get the impression 
that it was a small change, mostly for programming convenience.

(In case anyone's interested.)

--FC



Reply via email to