Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2007-10-17 (15:13)
From: Dario Teixeira <darioteixeira@y...>
Subject: Re: [Caml-list] Smells like duck-typing
> I would use something weaker, and I wouldn't use objects
> either. To me, this is essentially a dynamic scenario,
> so the data type should be dynamic. For example:
> 	type field_t = [
> 	| `Title of string
> 	| `Intro of string
> 	| `Body of string
> 	| `Field of string * string
> 	]
> 	type story_t = field_t list


Interesting idea, but how would you access the fields in a convenient
manner?  Note that nothing beats record access (say, story.title) or even
object method call (story#title) in convenience and readability.

(I guess the convenience aspect could be sorted out with a syntax
extension, but then we're moving into far more complex territory
than I hope is necessary...)


Want ideas for reducing your carbon footprint? Visit Yahoo! For Good