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 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 Sat, Aug 30, 2014 at 4:29 PM, François Rey <fmj...@gmail.com> wrote:
>
>>  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 within a mock function that may be retried and run in different
>> threads.
>>
>> In my case I used a list, e.g. (list obj), and used destructuring on the
>> other side when needed, e.g. [obj :as wobj].
>>
>>
>>  I have seen this:
>> http://stackoverflow.com/questions/20724219/simplest-possible-clojure-object-that-can-accept-a-primitive-and-metadata
>> but can't deref it since I can't change the functions that will use it
>> later. If I wrap this object I need to be able to delegate all of its
>> functionality to the original object.
>>
>> I don't think there's a quick solution without changing the contract.
>> Whatever solution is chosen you need to keep in mind how this will affect
>> things like equality, hashing, and instanceof?
>> Perhaps these links could be a start:
>> https://groups.google.com/forum/#!topic/clojure/9zCGdW_Q7o8
>>
>> http://stackoverflow.com/questions/9086926/create-a-proxy-for-an-specific-instance-of-an-object-in-clojure
>> Also, if the meta data is just for you own use, then you might want to
>> store it yourself in a map with weak references, or just use WeakHashMap
>> <http://docs.oracle.com/javase/7/docs/api/java/util/WeakHashMap.html>
>> directly. But then you'll be stateful...
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Kind Regards,
> Atamert Ölçgen
>
> -+-
> --+
> +++
>
> www.muhuk.com
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to