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:02:55 +0200
User-agent: Mutt/1.3.24i

On Thu, Aug 15, 2002 at 09:43:00PM +0200, Marius Vollmer wrote:
> address@hidden writes:
> 
> > BTW, i'm not really happy with guiles current behavior regarding declaring
> > a generic that's allready existing. I'd expect that a (define-generic foo)
> > on a function that's allready will be a no-opt.
> 
> Me neither.

I recall a discussion about that topic a while ago. I know i felt
uneasy back then ....

> >  (use-modules (oop goops))
> >  +
> >  =>  #<primitive-procedure +>
> >  (define-method (+ (a <string>) (b <string>)) (string-append a b))
> >  +
> >  => #<primitive-generic +>
> > 
> > Humpf! I know, this is actually a nice optimisation in this code, but
> > it shouldn't be so visible.
> 
> Should it print #<primitive-generic +> from the start?

Since it actually _is_ a generic from the start, yes, i think it should.
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.

> > So, if i understand you right, the compiler would generate code that
> > contains _two_ branches, one for the fast numeric code (inlined) and
> > one for the normal generic method dispatch?
> 
> Yes.

Ah, thank's for the clarification.

  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]