On Thu, Jun 13, 2013 at 10:52 AM, Jim - FooBar(); <jimpil1...@gmail.com>wrote:

> On 13/06/13 18:47, Jim - FooBar(); wrote:
>
>> On 13/06/13 18:28, Leon Barrett wrote:
>>
>>> It shouldn't be necessary to examine the source to know what's going on
>>> in a builtin, really, but I also encountered this one recently. The way the
>>> extend-protocol macro finds which entries are types and which are function
>>> definitions is by checking which are lists.
>>>
>>
>> I'm not sure I follow...if we can't have lists that evaluate to Class
>> objects  then how am I able to succesfully use (Class/forName "[D") as the
>> first extension but not in any other position?
>> should I be using (eval (Class/forName "[D")) so the macro definitely
>> receives a Class?
>>
>> You say you've encountered this a lot...can you elaborate? what did you
>> do?
>
>
If you want to understand why it behaves the way it does, then I do
encourage you to read the source(clj/clojure/core_deftype.clj). Basically,
it knows the first thing is a type and then uses (take-while seq?) to find
that type's methods.

extend-protocol is a macro that expands to a bunch of extend-type calls.
Just make a bunch of extend-type calls, or make your own macro that makes a
bunch of extend-type calls.


>> many many thanks,
>>
>> Jim
>>
>>
>>
>>
>>
> or can you perhaps show an example of successfully extending any protocol
> to at least 2 primitive array types?
>
>
> Jim
>
> --
> --
> 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+unsubscribe@**googlegroups.com<clojure%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/**group/clojure?hl=en<http://groups.google.com/group/clojure?hl=en>
> --- You received this message because you are subscribed to a topic in the
> Google Groups "Clojure" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/**
> topic/clojure/0TJ-Kl3CsDk/**unsubscribe<https://groups.google.com/d/topic/clojure/0TJ-Kl3CsDk/unsubscribe>
> .
> To unsubscribe from this group and all its topics, send an email to
> clojure+unsubscribe@**googlegroups.com<clojure%2bunsubscr...@googlegroups.com>
> .
> For more options, visit 
> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
> .
>
>
>

-- 
-- 
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/groups/opt_out.


Reply via email to