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: Felix Winkelmann
Subject: Re: [Chicken-users] <inexact> and <exact>
Date: Thu, 12 Aug 2004 07:18:55 +0200
User-agent: Opera M2/7.52 (Win32, build 3834)

On Wed, 11 Aug 2004 11:04:54 -0400 (EDT), Daniel B. Faken <address@hidden> wrote:

(On a side note: declaring a foreign type for your example thing didn't work out.
I have added now a real 'number' foreign type specifier, which does
the right thing)

  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).

Yes, the FFI parser is very helpful for quickly wrapping stuff. But if you
want full control, or have specialized demands, writing macros gives you
more freedom and the generated code looks exactly as you want it.

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

You mean forms similar to foreign-lambda... specifically for C++?

  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.

SWIG is actually pretty nice. But the support for C++ and Chicken is somewhat
clunky. There are still a few bugs in the Chicken-specific code for
wrapping C++. But SWIG may be overkill, unless you have a large batch of
code that uses many C++ features and needs to be wrapped consistendly in
short time.


cheers,
felix




reply via email to

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