I already have code which uses fn? everywhere. So i needed to inherit
Fn interface. Adding metadata to the function (basically, an id) was a
necessary afterthought. Basically, im using an emacs like hook
interface for the gui end of my application, so its hightly
configurable - but i need to know which namespace the function can
from (or id, if supplied), so that i can overwrite the hook when
adding a hook with similar ns/id.

On Feb 13, 9:08 pm, Ken Wesson <kwess...@gmail.com> wrote:
> On Sun, Feb 13, 2011 at 7:00 PM, Seth <wbu...@gmail.com> wrote:
> > Cool, thats what I thought. Sometimes, i wish i could inherit from a
> > class, but then i just use proxy to do it instead :) For example, i
> > made a function which acted like a fn? , but had some metadata. At
> > first i was going to use records, but couldnt because i needed to
> > inherit from Afn, but proxies worked beautifully!
>
> If you controlled the testing code, could you have used ifn? instead
> of fn?, or would ifn? returning true on things like vectors, maps, and
> sets have caused a problem?
>
> The ifn? function tests only for the interface IFn, which deftype can
> be used to implement (and defrecord implements by default as map
> lookup).

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

Reply via email to