2009/2/26 Rich Hickey <richhic...@gmail.com>

>
>
>
> On Feb 26, 8:30 am, Laurent PETIT <laurent.pe...@gmail.com> wrote:
> > 2009/2/26 Rich Hickey <richhic...@gmail.com>
> >
> >
> >
> >
> >
> > > On Feb 26, 4:17 am, Laurent PETIT <laurent.pe...@gmail.com> wrote:
> > > > 2009/2/26 Konrad Hinsen <konrad.hin...@laposte.net>
> >
> > > > > On 26.02.2009, at 01:51, Rich Hickey wrote:
> >
> > > > > > You raise interesting issues and I'd like to explore them
> further.
> > > I'm
> > > > > > not sure the issues you have with type-tag-or-class dispatch are
> all
> > > > > > that prohibitive. In any case, I've added a type function that
> > > returns
> > > > > > the :type metadata or the class if none:
> >
> > > > > Thanks, that helps a lot! With a built-in universal dispatching
> > > > > function, most of my problems should be solved. Another useful
> > > > > function to have would be
> >
> > > > > (defn type-instance?
> > > > >   "Evaluates x and tests if it is an instance of the type or class
> t.
> > > > >    Returns true or false"
> > > > >   [t x]
> > > > >   (identical? t (type x)))
> >
> > > > > for type-based dispatching inside a function.
> >
> > > > or maybe generalize the existing 'instance? function to the above
> > > definition
> > > > ?
> >
> > > I'm not sure I'd want to do that. You'd still need actual class
> > > detectors.
> >
> > But the definition and implementation of the above 'type-instance?
> function
> > works for classes, and I don't think the point of the current instance?
> is
> > to check that the given class parameter is a real class or not ? It is
> > checking the type of the instance passed to it ?
> >
> > Or am I missing something ?
> >
>
> The definition above is definitely broken in using identical?
>
> I'll think about extending instance? to use type + isa?


Yes, I agree. I hadn't realized the above definition was broken, and was
speaking about its purpose that I indeed thought could be integrated in
instance? without breaking instance? semantics nor existing code.

-- 
Laurent


>
>
> Rich
>
> >
>

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