Version française
Home     About     Download     Resources     Contact us    
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
-----BEGIN PGP SIGNED MESSAGE-----
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 
happens.

Peng



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?


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)

iD8DBQFHRtisfIRcEFL/JewRAtu3AKCX4EsMl2voDuUlg49X78uM0ZgPiQCeMHBt
7K3oParomxx8Td4ewoa3u/4=
=Z9Zz
-----END PGP SIGNATURE-----