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: embedding question: defining symbols?



> > So I think (if I can read your C++) that you want to make a C++ class
> > that wraps Guile symbol objects with a few methods, and then use a
> > Dictionary<Guile_Symbol> in class Bla.  
> 
> Is it guaranteed that the value of SCM is not changed from under
> during GC, so that I can just use ((SCM >> 32) ^ (SCM & 0xffffffff))
> as a hashing function?

Well, at the moment, that's true, but at some point in the future we
might have a copying or compacting GC, so I wouldn't do that.

Use the function scm_ihashv in hash.c to get a hash value for a
symbol's name.

> > That is, find some way to use
> > symbols as the keys in your table.
> > 
> > When Guile acquires real first-class environments, then you may want
> > to change your code.
> 
> So what you are saying is, that I also cannot recode C++ methods in
> Scheme? Hmm...

Hmm.  I'm absolutely positive I don't understand what you mean here.
:(  Can you explain?  Would you like to replace some of your methods
written in C++ with methods written in Scheme?


> > I wonder if Guile's new MOP could somehow accomodate your classes, and
> > let LilyPond objects be subclassed in Scheme, etc.
> 
> What is a MOP?

It's something you use for cleaning floors!

Actually, it's an interface supported by Guile's object system that
allows users to customize its implementation.  I'm not very familiar
with its abilities myself at the moment.