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
[Caml-list] Delegation based OO
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Alex Baretta <alex@b...>
Subject: [Caml-list] Delegation based OO
Away from politics and back to the ordinary stuff...

Presently Ocaml supports the following OO paradigm:

class does_something = object .. end

class does_more = object
   inherit does_something

This allows us to extend the functionality of CLASSES. What about 
extending the functionality of objects?

class *type* does_something = object ... end

class does_more (an_object:#does_something) = object
   delegates an_object

This is very important to me because in my code I often use the concept 
of proxy-object.

let prototype = match whatever with
   | ... as first_case -> new does_it_the_first_way
   | ... as second_case -> new does_it_the_second_way
   | ... as third_case -> new does_it_the_third_way

class does_more prototype = object
   method one = prototype # one
   method two = protype # two

This is really a pain. I would expect delegation to be supported in the 
coolest OO language under the sun ;)

O great Caml breeders, what do you say to this?


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: