Version française
Home     About     Download     Resources     Contact us    
Browse thread
Smells like duck-typing
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] Smells like duck-typing

On Wed, 2007-10-17 at 17:32 +0200, Daniel Bünzli wrote:
> Le 17 oct. 07 à 17:13, Dario Teixeira a écrit :
> 
> >> 	type field_t = [
> >> 	| `Title of string
> >> 	| `Intro of string
> >> 	| `Body of string
> >> 	| `Field of string * string
> >> 	]
> >>
> >> 	type story_t = field_t list
> >>
> > Interesting idea,
> 
> If this is right for you then what you want is property lists and  
> these two solutions [1,2] may be of interest to you.

Yes, my 'solution' is just a hint. Felix actually uses
something similar to the above structure to record properties 
of functions, eg 'pure', 'inline', etc.

This kind of data structure is weakly typed, but that's 
part of the idea. Someone probably has an actual representation
of BibTeX data, which is similar in spirit.

Perhaps this weak typing is too weak and can be beefed up,
for example if the title is mandatory, a record PLUS
a property list.

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net