Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Default values for structures (feature request)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Richard Jones <rich@a...>
Subject: Re: [Caml-list] Default values for structures (feature request)
On Wed, Jun 02, 2004 at 09:56:55PM +0900, Jacques GARRIGUE wrote:
> From: Richard Jones <rich@annexia.org>
> 
> > Could have a syntax for default values for structures?  Something
> > like:
> > 
> > type t = { field1 : int = 0;
> >            field2 : string;  (* no default *)
> >          }
> 
> The difficulty should be apparent in your example: this supposes
> writing values in interfaces, which would be a major (huge) change in
> language design...

Out of interest, is there a theoretical reason why types shouldn't
contain values, or is it just because it's a lot of work to change the
compiler?

Rich.

-- 
Richard Jones. http://www.annexia.org/ http://www.j-london.com/
Merjis Ltd. http://www.merjis.com/ - improving website return on investment
Perl4Caml lets you use any Perl library in your type-safe Objective
CAML programs. http://www.merjis.com/developers/perl4caml/

-------------------
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