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
Adding methods to an object
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Peng Zang <peng.zang@g...>
Subject: Re: [Caml-list] Adding methods to an object
Hash: SHA1

Hey Jon,

I was hoping someone else would answer your question and enlighten me as well, 
but that doesn't appear to be happening.  Sooo, here's my .02

I don't think there's an easily way to do this for an arbitrary object.  The 
main problem being the difficulty with ensuring that the return object has 
the same methods as the original (plus some others).  That would require 
inheritance at an object level as opposed to class level.

Alternatively if one knew how messages to objects happen, one could create a 
wrapper object to provide the new methods and passthrough any messages it 
doesn't recognize.  But I have no idea how the internals of messaging 


On Saturday 17 November 2007 09:43:59 am Jon Harrop wrote:
> Given an object that provides a variety of methods, how do you create an
> return an object that augments the given object with more methods?

Version: GnuPG v2.0.7 (GNU/Linux)