On Mon, Mar 22, 2010 at 1:43 PM, Meikel Brandmeyer <m...@kotka.de> wrote:
> Hi,
>
> On Mar 22, 7:13 am, Per Vognsen <per.vogn...@gmail.com> wrote:
>
>> As a solution, I factored the reify out into a deftype:
>>
>> http://gist.github.com/339834
>
> A short note: you don't have to use :keyword notation in the methods.
> The attributes of the type are available under their names.

Good to know. Thanks!

>
>> Unfortunately, the Promise deftype is no longer intercepted by the
>> print-method for IDerefs. I guess it has to do with the deftype
>> hierarchy vs Java hierarchy.
>
> No. The "problem" is, that for each type there is a unique print-
> method installed by deftype. You have to re-define this method and
> call the method for clojure.lang.IDeref directly. (See also above
> paste.)

Okay, I made this change and changed the IDeref print-method so that
it behaves similarly for futures and promises:

http://gist.github.com/339834

However, the better way is probably to have individual print-methods
for promises and futures, so the general purpose code for IDerefs
doesn't have to contain these unsightly special cases.

-Per

>
> Sincerely
> Meikel
>
> --
> 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
>
> To unsubscribe from this group, send email to 
> clojure+unsubscribegooglegroups.com or reply to this email with the words 
> "REMOVE ME" as the subject.
>

-- 
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

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.

Reply via email to