Re: Protocols and name collisions

2011-04-11 Thread babui
It has worked like a charm. Thanks. Juan Manuel On 11 abr, 16:45, Meikel Brandmeyer wrote: > Hi, > > On 11 Apr., 16:35, babui wrote: > > > (ns b > >     (:use a :as mya)) > > You want require here, not use. (ns b (:require [a :as mya])) > > Sincerely > Meikel -- You received this message bec

Re: Protocols and name collisions

2011-04-11 Thread Meikel Brandmeyer
Hi, On 11 Apr., 16:35, babui wrote: > (ns b >     (:use a :as mya)) You want require here, not use. (ns b (:require [a :as mya])) 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@google

Re: Protocols and name collisions

2011-04-11 Thread babui
I'm having trouble avoiding name collisions with protocols. A third- party librery defines: (ns a) (defprotocol PA (fa [this ...]) (ga [this ..]) (ha [this ..]) .) And i want to be able to use some of this protocol for a type I'm defining. So I do (ns b (:use a :as mya)) (d

Re: Protocols and name collisions

2011-04-11 Thread babui
Do protocols respect namespace rewriting? For instance: We define a protocol in a namespace: (ns a) (defprotocol P (p [this])) (defn g[] ) This works: (ns b On 6 abr, 00:02, Stuart Sierra wrote: > You can omit clojure.core/first from your namespace like this: > > (ns your.namespace

Re: Protocols and name collisions

2011-04-05 Thread Stuart Sierra
You can omit clojure.core/first from your namespace like this: (ns your.namespace (:refer-clojure :exclude (first))) Users of your library could do the same, and also `(:use your.namespace)` to have access to your alternate definition of `first`. -Stuart Sierra clojure.com -- You received t

Re: Protocols and name collisions

2011-04-04 Thread Alan
You can't turn clojure.core/first into a protocol - it's already a bare function. When you define a protocol with a first method, you define a new function in your namespace called first, which delegates to protocol implementations. The compiler is complaining that you're shadowing clojure.core/fir

Protocols and name collisions

2011-04-04 Thread Timothy Baldridge
I'm trying out some protocol code. Here's what I'm trying: (defprotocol AFirst (first [s])) this blows up with : (defprotocol AFirst (first [f])) Warning: protocol #'foo/AFirst is overwriting function first WARNING: first already refers to: #'clojure.core/first in namespace: foo, being replaced