I see, thanks for the clarification. It does seem like you are purposefully
creating a situation in which type will fail since something more likely:
(type (proxy [clojure.lang.IRef][]))

works fine.

I'm wondering if a CLOS-like system would really have to handle such a
degenerate (in the technical sense :) case as the one you've pointed out?
I'm interested in hearing reasons if there is one.

David

On Sun, Mar 29, 2009 at 5:22 PM, mikel <mev...@mac.com> wrote:

>
>
>
> On Mar 29, 1:34 am, David Nolen <dnolen.li...@gmail.com> wrote:
> > On Sun, Mar 29, 2009 at 1:25 AM, mikel <mev...@mac.com> wrote:
> >
> > > (type (proxy [clojure.lang.IMeta clojure.lang.IRef][]))
> >
> > > java.lang.UnsupportedOperationException: meta (NO_SOURCE_FILE:0)
> > >  [Thrown class clojure.lang.Compiler$CompilerException]
> >
> > > No doubt someone is going to point out that the proxy object I created
> > > there is useless; that's true, but beside the point. The point is that
> > > it's straightforward to create some value v for which (type v) is
> > > undefined. In order to make a Clojure-friendly version of CLOS, you
> > > need some concept of object type such that you can define a function
> > > that returns a sensible type for any value.
> >
> > Not totally following you here as:
> >
> > (proxy [clojure.lang.IMeta clojure.lang.IRef][])
> >
> > immediately throws an error. I can't think of a situation in Clojure
> where
> > the type function does not return a usable value. Let me know if I'm
> wrong,
> > but your example is not a case as far as I can tell.
>
> If you type that expression at the REPL, it throws for the same reason
> that calling type on it throws: because the print method for it calls
> meta, which is not implemented.
> >
>

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