guile-devel
[Top][All Lists]
Advanced

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

Re: Newbie question on writing bindings.


From: Martin Grabmueller
Subject: Re: Newbie question on writing bindings.
Date: Wed, 18 Apr 2001 06:40:49 +0200

> From: Neil Jerram <address@hidden>
> Date: 17 Apr 2001 22:22:14 +0100
> 
> >>>>> "Martin" == Martin Grabmueller <address@hidden> writes:
> 
>     >> From: Joel Smith <address@hidden> Date: Sat, 14 Apr 2001
>     >> 21:59:27 +0000 (GMT)
>     >> 
>     >> How do I write bindings for such functions? I thought about
>     >> passing the various values as a list but that does not seem
>     >> like the Right Thing to me. I also thought of using keyword
>     >> arguments like this:
>     >> 
>     >> (baz #:foo #t :#bar #t)

[...]

>     Martin> I haven't tried to use keywords in Guile extensions yet,
>     Martin> but I think you would have to
> 
>     Martin> 1. Define your primitive written in C to accept
>     Martin> arbitrarily many arguments. [...]
> 
>     Martin> But personally, I like it better to write the primitive
>     Martin> `baz' in a way that it can be called like
> 
>     Martin> (baz 'foo 'bar) [...]
> 
> Also, as a general idea, consider defining your C primitive so that
> it's easy to write in C, and then write a Scheme level wrapper
> function with an interface that is convenient to call.  For example:

[...]

> In other words, it much easier to do nice interfacey stuff in Scheme
> than in C.

Maybe this thread would be something to go into the Reference Manual
as a new subsection under `Scheme Primitives'?  Just a thought...

Regards,
  'martin



reply via email to

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