chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] <inexact> and <exact>


From: Daniel B. Faken
Subject: Re: [Chicken-users] <inexact> and <exact>
Date: Wed, 11 Aug 2004 11:04:54 -0400 (EDT)

On Wed, 11 Aug 2004, Felix Winkelmann wrote:
> On Tue, 10 Aug 2004 17:40:24 -0400 (EDT), Daniel B. Faken  
> <address@hidden> wrote:
> >   I am working with a C++ library which has methods that take a 'double'.
> >   Using declare(full_specialization, yes) I can get TinyCLOS to recognize
> > method calls when the parameter is of the form 1.0001, but not if it is
> > just '1' - I get an error looking for an <exact> method.
> >   This seems supported by R5RS saying that exactly one of exact? and
> > inexact? is true, but how can I get my methods to recognized exact  
> > numbers
> > as well?  (I don't really want to define an <exact> case for each one..)
> >
> 
> I assume you  really require full_specialization, correct?

I think so;  I'm using overloaded functions.

> Is it possible for you to change the original code? Because then
> you could use the "type" pseudo declaration:
> 
[snip]

Felix,

  Thanks; yes, I can do that - I was just trying to avoid the changing, 
but that is pretty minor.

  On a related subject, I discovered the (documented) fact that the 
methods weren't really being specialized on C++ objects (e.g. I have a 
function myobj::add(myobj &, double) and it becomes "fully specialized" as 
(define-method (add (me (instance myobj <myobj>) (a <top>) (b 
<inexact>))).
  I've pretty much settled on just writing some macros to wrap functions 
the exact way I want.  This also allows me to maybe switch object systems 
in the future (e.g. meroon).
  Do you think chicken will be able to handle the class-specializations 
(maybe via user-defined class specification?) and/or different object 
systems any time soon?  Maybe there could just be a user-accessible 
version of the bindings that currently tie C++ to TinyCLOS?
  I would like to implement it myself, but don't have time..

  I also looked into SWIG, but for my purposes (C++ header file ~2-300 
lines) - and based on the SWIG mailing-list discussion - it seems simpler 
and more robust to just write macros.

thanks,
Daniel Faken






reply via email to

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