Re: defprotocol's support for variadic arguments seems broken

2010-04-06 Thread Jarkko Oranen

On Apr 6, 8:16 am, Zach Tellman ztell...@gmail.com wrote:
 Possibly this fall out from the latest commit requiring an explicit
 'this' reference (ba6cc3b), I haven't checked any versions but the
 most recent.

 user (defprotocol Protocol (f [a b  c]))
 Protocol
 user (def p (reify Protocol (f [a b  c] [a b c])))
 #'user/p

 user (f p :a :b :c)
 [#user$reify__1503 user$reify__1...@31e2ad :a :c]

Did protocols ever support variadic arguments? It seems to me that in
this case  gets treated as a regular symbol and a gets bound to the
object itself, b to :a,  to :b and c to :c, which would explain the
weird output.

-- 
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, reply using remove me as the subject.


Re: defprotocol's support for variadic arguments seems broken

2010-04-06 Thread Zach Tellman
You're right, that does explain it.  I assumed that variadic arguments
were supported, but maybe I was wrong.  Can anyone confirm whether or
not this was ever intended to work?


On Apr 6, 2:32 am, Jarkko Oranen chous...@gmail.com wrote:
 On Apr 6, 8:16 am, Zach Tellman ztell...@gmail.com wrote:

  Possibly this fall out from the latest commit requiring an explicit
  'this' reference (ba6cc3b), I haven't checked any versions but the
  most recent.

  user (defprotocol Protocol (f [a b  c]))
  Protocol
  user (def p (reify Protocol (f [a b  c] [a b c])))
  #'user/p
  user (f p :a :b :c)
  [#user$reify__1503 user$reify__1...@31e2ad :a :c]

 Did protocols ever support variadic arguments? It seems to me that in
 this case  gets treated as a regular symbol and a gets bound to the
 object itself, b to :a,  to :b and c to :c, which would explain the
 weird output.

-- 
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, reply using remove me as the subject.


defprotocol's support for variadic arguments seems broken

2010-04-05 Thread Zach Tellman
Possibly this fall out from the latest commit requiring an explicit
'this' reference (ba6cc3b), I haven't checked any versions but the
most recent.

user (defprotocol Protocol (f [a b  c]))
Protocol
user (def p (reify Protocol (f [a b  c] [a b c])))
#'user/p
user (f p :a)
No single method: f of interface: user.Protocol found for function: f
of protocol: Protocol
user (f p :a :b)
No single method: f of interface: user.Protocol found for function: f
of protocol: Protocol
user (f p :a :b :c)
[#user$reify__1503 user$reify__1...@31e2ad :a :c]
user (f p :a :b :c :d)
No single method: f of interface: user.Protocol found for function: f
of protocol: Protocol

Even the one signature that doesn't result in an exception doesn't
seem right.

-- 
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, reply using remove me as the subject.