Re: How can I add meta to an object that doesn't implement IObj?

2014-09-01 Thread adrian . medina
Sorry, I overlooked that you already ruled out all IDeref instances. On Sunday, August 31, 2014 10:21:39 PM UTC-4, Atamert Ölçgen wrote: On Mon, Sep 1, 2014 at 1:52 AM, adrian...@mail.yu.edu javascript: wrote: If you don't want to wrap the object in an atom, you can also reify an

Re: How can I add meta to an object that doesn't implement IObj?

2014-09-01 Thread James Reeves
I'm not sure whether this would apply in your case, but have you considered using a WeakHashMap instead of Clojure's metadata? - James On 31 August 2014 09:55, Atamert Ölçgen mu...@muhuk.com wrote: Hi Francis, On Sat, Aug 30, 2014 at 1:34 PM, Francis Avila franci...@gmail.com wrote: It

Re: How can I add meta to an object that doesn't implement IObj?

2014-08-31 Thread Atamert Ölçgen
Hi Francis, On Sat, Aug 30, 2014 at 1:34 PM, Francis Avila franci...@gmail.com wrote: It would probably help if you said more about the source of this atom-holding object. Is it a plain Java class? A deftype/defrecord? Is it final? It's not an atom-holding object. The only guarantee is

Re: How can I add meta to an object that doesn't implement IObj?

2014-08-31 Thread adrian . medina
If you don't want to wrap the object in an atom, you can also reify an object that supports IDeref which returns your object. All reified objects support IObj out of the box. On Sunday, August 31, 2014 4:55:58 AM UTC-4, Atamert Ölçgen wrote: Hi Francis, On Sat, Aug 30, 2014 at 1:34 PM,

Re: How can I add meta to an object that doesn't implement IObj?

2014-08-31 Thread Atamert Ölçgen
On Mon, Sep 1, 2014 at 1:52 AM, adrian.med...@mail.yu.edu wrote: If you don't want to wrap the object in an atom, you can also reify an object that supports IDeref which returns your object. All reified objects support IObj out of the box. As I said earlier: ... can't deref it since I can't

Re: How can I add meta to an object that doesn't implement IObj?

2014-08-30 Thread François Rey
On 30/08/14 05:15, Atamert Ölçgen wrote: Obviously I can't. But I need to add this capability to an object. During testing I attach meta to this object that contains an atom. Then I pass this object to other functions, known in runtime. I can't use a dynamic var because all this happens

Re: How can I add meta to an object that doesn't implement IObj?

2014-08-30 Thread Atamert Ölçgen
Hi François, Thanks for the links. I can't really pass a list since the first function is expecting the object I am passing, then it calls some other functions that were supposed to extract the meta. The problem is, functions that are called later can be executed in a different thread. On

Re: How can I add meta to an object that doesn't implement IObj?

2014-08-30 Thread Alex Baranosky
The only way to do this is to wrap the object in something that implements IObj. But at that point you might as well wrap it in a regular hashmap and just wrap it in real data. On Sat, Aug 30, 2014 at 1:54 AM, Atamert Ölçgen mu...@muhuk.com wrote: Hi François, Thanks for the links. I can't

Re: How can I add meta to an object that doesn't implement IObj?

2014-08-30 Thread Francis Avila
It would probably help if you said more about the source of this atom-holding object. Is it a plain Java class? A deftype/defrecord? Is it final? If you can control the construction of this object and its class is not final, you can subclass it and add an IObj implementation. (Note that most,

Re: How can I add meta to an object that doesn't implement IObj?

2014-08-30 Thread Gary Trakhman
Can you monkey-patch the meta function itself to draw from a map of object to meta? On Saturday, August 30, 2014, Francis Avila franci...@gmail.com wrote: It would probably help if you said more about the source of this atom-holding object. Is it a plain Java class? A deftype/defrecord? Is it

How can I add meta to an object that doesn't implement IObj?

2014-08-29 Thread Atamert Ölçgen
Obviously I can't. But I need to add this capability to an object. During testing I attach meta to this object that contains an atom. Then I pass this object to other functions, known in runtime. I can't use a dynamic var because all this happens within a mock function that may be retried and run