guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Smart variables, dumb variables


From: rm
Subject: Re: Smart variables, dumb variables
Date: Thu, 15 Aug 2002 22:25:21 +0200
User-agent: Mutt/1.3.24i

On Thu, Aug 15, 2002 at 10:02:09PM +0200, Marius Vollmer wrote:
> address@hidden writes:
> 
> > > Should it print #<primitive-generic +> from the start?
> > 
> > Since it actually _is_ a generic from the start, yes, i think it should.
> 
> Ok, agreed.  Objections?
> 
> > Of course, what i'm really after is a test like 'generic? foo' so that
> > i can write a macro that does what i think guile should do. Make 'foo'
> > a generic iff it's not one allready.
> 
> You can't really do that I think.  You can't change a procedure into a
> generic function.  What you can do is change the value of a variable
> to point to a new function, which is generic.  But maybe that is what
> you want.

Excuse my slopy language - i was thinking more of the net result.
So i guess my macro would have to save the original value (the one
pointing to the procedure) and then, after a define-generic, issue
a define method that rebinds the value to a generic method with 
a parameter signature of '<object>'. Kind of clumsy.

> There is no 'generic?' but you can maybe define it like so

I couldn't find one (which i found astonishing as well).

>   (define (generic? obj)
>     (or (is-a? obj <generic>)
>         (is-a? obj <primitive-generic>)))

Yes, i guess that would do the trick.

  Ralf

 :
> 
> -- 
> GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405




reply via email to

[Prev in Thread] Current Thread [Next in Thread]