guile-user
[Top][All Lists]
Advanced

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

Re: Newbie - desigining apps


From: Julian Graham
Subject: Re: Newbie - desigining apps
Date: Thu, 7 Oct 2004 22:49:04 -0400

Hi Max,
  It might help the people on this list to have a little bit more
information about the type of application you're trying to write.  For
the sake of my response, I'm going to assume it's an application where
some degree of extensibility makes sense -- it goes without saying
(although I guess I'm saying it) that just because Guile is the
recommended extensibility language for Free Software projects doesn't
mean you need to support it in your Free Software project.
  To your specific questions:

> Have others found that supporting Guile in an application means
> rethinking how it runs at it's very core?  For example, instead of
> writing use cases and designing from that, now I have a use case like
> "let the user call any higher-level function".

  There are some basic requirements for using Guile in your code that
are going to affect the "core" -- the most obvious example is that
you'll probably need to wrap most of the functionality of your current
main() in the function called by scm_boot_guile().  Second, if you
really do want to make it possible to let users call "core" functions
from Guile Scheme code, you'll need to make these functions (or
wrappers around them) able to handle Guile's SCM type.  (Making your
software Guile-controllable may require enough work that you may find
it not much more difficult to provide an abstraction layer that would
let your "higher-level functions" be accessed by a variety of
different user interfaces, not just Guile.)
  In terms of use-cases, the Guile manual describes a few different
ways that people tend to want to use Guile.  A couple of the most
common are: Using Guile to provide a built-in Scheme interpreter for
your application -- .e.g., you're writing a spreadsheet and need a
language for people to write formulas in and a way to evaluate
expressions in those formulas; vs. what you seem to talking about,
which is providing a set of C functions that do something and using
Guile as a way to access them and use them in conjunction with
pre-existing features of Scheme and libraries of Scheme code.

> Even worse, what about object orientation?  Is it possible to let the
> user create, then assemble together, use, then destroy various program
> objects, all from Guile?  And how is even that done, returning C++
> objects back to Guile -- I assume you would have to return a handle
> representing the internal program object, then add some management layer
> that maps these handles to internal objects.

  Yes, it is possible to let users construct relatively complex types
from Guile and pass them to and from C++ code.  You do this by
explicitly exposing (via a Guile API call) the type to Guile and
providing some basic information to Guile on how to display it /
garbage-collect it / etc.  You'll want to consult the Guile manual for
the specifics on how to do this.

> Can someone can start me off on the right foot?

  Give the manual -- especially the descriptions of Scheme
programming, if you're not a functional-programming kind of person --
a thorough going-over, even though certain parts of it are out of date
or incomplete.  I should mention that I'm not exactly a Guile expert. 
Other people on this list may have better ideas.


Cheers,
Julian




reply via email to

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