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-18 (19:55)
From: Robert Fischer <robert@f...>
Subject: Re: [Caml-list] Smells like duck-typing

> But that never happens with mutators because you cannot
> HAVE any additional invariants. The derived type has
> to have exactly the same set of values as the base,
> in which case you cannot have any new interesting
> methods -- any method you have can always be defined
> in terms of the characteristic methods already in
> the base (assuming the whole public state is accessible
> of course).
This is why you 1) define a base class which has a very loose set of 
invariants or 2) obscure state from inheriting classes.

~~ Robert.