From: Nicolas C. <war...@fr...> - 2003-03-17 08:24:54
|
Hi list, I have been thinking for some time on the module structure for ExtLib issues, and I think I found a quite reasonable comprise. Ok, first of all, we we talk there only about modules which are extending the StdLib ones, other "new" modules doesn't cause any problems. But for the Stdlib one - let's take the example of ExtList - there is some problems : - some people would like to use ExtList as a replacement of List For this first category of people, we can do the following : -- file extList.mli --- module List : sig ... end --- eof --- Like this theses people will only have to add an extra "open ExtList" in the beginning of their files and then they can use the List standard functions as well as the List extended ones within the same short and readable namespace : List. But ! - this we're modifying the specification of some functions, people with existing running code would like to use only ExtList as an additionnal library of functions, without overriding the current Stdlib ones. Here's the answer : --- file extLib.mli --- module ExtList = ExtList.List --- eof --- So they only have to do an "open ExtLib" and then they can use extended functions under the ExtList namespace. Nicolas Cannasse |
From: fva <fv...@ts...> - 2003-03-20 15:26:20
|
Nicolas Cannasse wrote: >Hi list, > >I have been thinking for some time on the module structure for ExtLib >issues, and I think I found a quite reasonable comprise. >Ok, first of all, we we talk there only about modules which are extending >the StdLib ones, other "new" modules doesn't cause any problems. >But for the Stdlib one - let's take the example of ExtList - there is some >problems : > >- some people would like to use ExtList as a replacement of List > >For this first category of people, we can do the following : > >-- file extList.mli --- >module List : sig ... end >--- eof --- > >Like this theses people will only have to add an extra "open ExtList" in the >beginning of their files and then they can use the List standard functions >as well as the List extended ones within the same short and readable >namespace : List. > >But ! >- this we're modifying the specification of some functions, people with >existing running code would like to use only ExtList as an additionnal >library of functions, without overriding the current Stdlib ones. > >Here's the answer : >--- file extLib.mli --- >module ExtList = ExtList.List >--- eof --- > >So they only have to do an "open ExtLib" and then they can use extended >functions under the ExtList namespace. > >Nicolas Cannasse > How was that going...? Vote +1 for this proposal... Regards, Fran |
From: Manos R. <er...@cs...> - 2003-03-20 20:43:01
|
This still does let one use all of ExtLib with a simple open ExtLib I think that module ExtLib = struct module List = ExtList ... end will solve this problem. -- Manos On Mon, Mar 17, 2003 at 05:23:57PM +0900, Nicolas Cannasse wrote: > Hi list, > > I have been thinking for some time on the module structure for ExtLib > issues, and I think I found a quite reasonable comprise. > Ok, first of all, we we talk there only about modules which are extending > the StdLib ones, other "new" modules doesn't cause any problems. > But for the Stdlib one - let's take the example of ExtList - there is some > problems : > > - some people would like to use ExtList as a replacement of List > > For this first category of people, we can do the following : > > -- file extList.mli --- > module List : sig ... end > --- eof --- > > Like this theses people will only have to add an extra "open ExtList" in the > beginning of their files and then they can use the List standard functions > as well as the List extended ones within the same short and readable > namespace : List. > > But ! > - this we're modifying the specification of some functions, people with > existing running code would like to use only ExtList as an additionnal > library of functions, without overriding the current Stdlib ones. > > Here's the answer : > --- file extLib.mli --- > module ExtList = ExtList.List > --- eof --- > > So they only have to do an "open ExtLib" and then they can use extended > functions under the ExtList namespace. > > Nicolas Cannasse > |
From: Nicolas C. <war...@fr...> - 2003-03-24 02:45:03
|
> This still does let one use all of ExtLib with a simple > open ExtLib > > I think that > > module ExtLib = struct > module List = ExtList > ... > end > > will solve this problem. Perhaps, but I wonder then if you're doing open ExtLib are you linking with all the modules ExtList, ExtHashtbl, ExtString... even if you're not using them ? Nicolas Cannasse |
From: Nicolas C. <war...@fr...> - 2003-03-25 01:40:16
|
> > This still does let one use all of ExtLib with a simple > > open ExtLib > > > > I think that > > > > module ExtLib = struct > > module List = ExtList > > ... > > end > > > > will solve this problem. > > Perhaps, but I wonder then if you're doing > open ExtLib > are you linking with all the modules ExtList, ExtHashtbl, ExtString... even > if you're not using them ? I have checked the following. When you're doing "open ExtLib" it will really link all the modules declared in extLib.ml, even if later the application does not use them. We have then three choices : - use my module structure proposal, that will cause the users which are using ExtLib as an extension to link all the overidden modules - use Manos Renieris one, that will cause the users which are using ExtLib as an StdLib replacement to link all the overidden modules - find another prefix keyword ( for exemple Std ) so there is no more ExtLib module, but it can be use : As a replacement of the List standard module : --- test.ml --- open StdList List.map f l --- stdList.mli --- module List : sig <...> end As a extended library of functions : --- test.ml --- ExtList.map f l -- extList.ml ---- include StdList.List Nicolas Cannasse |