Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] extensible records?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Alexander S. Usov <A.S.Usov@K...>
Subject: Re: [Caml-list] extensible records?
On Friday 27 February 2004 01:45, you wrote:
> Hi everyone!
>
> I'm having a problem figuring out how to implement something in ocaml, and
> I'd like to solicit advice.  I'm writing a little dynamically-typed
> language in ocaml, and I want to be able to add new types to the language
> without having to add new primitive types to the system.  So, for instance,
> my basic type definition looks something like this:
>
>     type data =
>         Int of int
>
>       | Float of float
>       | ...
>
> Mike

I am not hundred percent sure, but you can use parametrized definition.
Like this:

type 'a data =
	Int of int
	| Float of float
	| .....
	| Extension of 'a ;;

-- 
Best regards,
  Alexander.

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners