This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Creating environments/frames ?


Hello, Han-Wen

Han-Wen Nienhuys <hanwen@cs.uu.nl> writes:

> I am trying to integrate GUILE into LilyPond, and I have questions.
> Please forgive, I am a newbie: I have never really used Scheme.

Good luck to you.  I will try to help.

> I want to integrate scheme frames into C++ classes, in the following
> manner: there are classes Paper and Graphical_object (with concrete
> derivations Beam and Stem), that currently basically look like

I can't tell from your post why you want to integrate frames into your
application.  Usually these are Scheme data structures that are
manipulated only by the Scheme system.  I think there is probably a
different way to accomplish your goal that uses guile in a more
traditional fashion.

> PROBLEM 
> How do I do this?   

I didn't completely understand from your post what you are trying to
accomplish, so I will try to read between the lines and make some
proposals.  If I'm completely missing the point, I apologize in
advance.

First, it sounds like you want to have two smobs, one for
Graphical_Object and one for Paper.

I think you also want to have primitive procedures that perform the
following actions:

; returns a list of all graphical objects contained in PAPER
(lily:paper->graphical-object-list PAPER)

; returns the paper associated with a graphical objec
(lily:graphical-object->paper GRAPHICAL-OBJECT)

And then also some primitives that allow the programmer to have
access to other attributes of PAPER and GRAPHICAL-OBJECT.

I think you are going to have to develop an approach for dealing with
the GC of your objects.  What happens if a Scheme wrapper around one
of your objects lives longer than the object it's wrapping?  (Emacs
has to deal with this issue with buffers; thus the notion of
'buffer-live-p')

If you can give a more general description of what you are trying
to do, maybe I can help with more specific suggestions.

-russ

--
Hofstadter's Law: It always takes longer than you expect, even when you 
take into account Hofstadter's Law.