local opening

From: Pierre CASTERAN (Pierre.Casteran@labri.u-bordeaux.fr)
Date: Tue Feb 24 1998 - 09:50:01 MET


Date: Tue, 24 Feb 1998 09:50:01 +0100 (MET)
Message-Id: <199802240850.JAA01161@scrasmeustache.labri.u-bordeaux.fr>
From: Pierre CASTERAN <Pierre.Casteran@labri.u-bordeaux.fr>
To: caml-list@inria.fr
Subject: local opening

 Hello,

 Is it possible to open a module inside a single expression ?

 I tried :

module Compl=
  struct
    type compl=float*float

    let compl(r:float)=(r,0.0)

    let i=(0.0,1.0)

    let add(((a,b):compl),((a',b'):compl))=
         (a+.a',b+.b')

    let mult(((a,b):compl),((a',b'):compl))=
         (a*.a'-.b*.b',a*.b'+.b*.a')
  end;;

let open Compl
  in mult(i,i);;

but it produced a syntax error .

Is it possible to avoid an heavy :

Compl.mult(Compl.i,Compl.i);;

or a (global) opening of Compl ?

Best regards,

Pierre



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:13 MET