Version française
Home     About     Download     Resources     Contact us    
Browse thread
compilation of lablgl examples.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Pierre Weis <Pierre.Weis@i...>
Subject: Re: compilation of lablgl examples.
> Pierre Weis wrote:
[...]
> > Sometimes you can use polymorphism to
> > help for instance defining
> > 
> > | Function of 'parameter list * typecode_t * 'b
> > 
> > could be used to modelize both
> > | DCL_function of   parameter_t list * typecode_t * asm_t list
> > | BDCL_function of   bparameter_t list * btypecode_t * int list *
> >  exe_t list * name_map_t
> 
> 	I'm not sure how: these two declarations are for variant 
> components of _distinct_ types.
[...]
> John (Max) Skaller, mailto:skaller@maxtal.com.au
> 10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
> checkout Vyper http://Vyper.sourceforge.net
> download Interscript http://Interscript.sourceforge.net

Right. I meant you define only one type

type ('parameter, 'b) ast =
   | Function of 'parameter list * typecode_t * 'b;;

Then you define two abbreviations instances of ast to define the types
to which DCL_function and BDCL_function belong:

type dcl = (parameter_t, asm_t list) ast
and bdcl = (bparameter_t, int list * exe_t list * name_map_t) ast;;

That's only an idea: if types are too diffrent the number of type
parameters rapidly becomes excessive.

Regards,

Pierre Weis

INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/