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] |
jimb@red-bean.com writes: > Use the function scm_ihashv in hash.c to get a hash value for a > symbol's name. OK. > > > 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? My actual objective is to go from code that looks like class Foo { int bla; Bar * bar_p; void do_something () { if (!bla) bla = bar_p->blub * 2; } Foo () { } } to something that is written in Scheme, and where methods can be overriden at runtime. I know that I am sounding very sketchy, but to do the things I want to do, I feel that I must somehow use GUILE evaluation and namespace stuff. So I am trying to get a grip on how they work. Perhaps the below demonstrates what I want: (define (make-foo) (define (Foo fun) (define bla 1) (define bar-pointer '()) (define (calculate-bla) (set! bla (* 2 ((bar-pointer 'access) 'blub))) ) (define (access-fun sym) (eval sym)) (if (eq? fun 'access) access-fun ) ) Foo ) I want to make the change from C++ to scheme gradually, so I must integrate the semantics of Scheme and C++ somewhat: I want to associate a namespace / environment / whatever to every Foo class I create, and one by one, move the C++ variables (and their associated code) to the SCM variables and SCM code.. > 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. But I've got some links, though. Is MOP usable right now? Does it work in GUILE 1.3? > -- Han-Wen Nienhuys, hanwen@cs.uu.nl ** GNU LilyPond - The Music Typesetter http://www.cs.uu.nl/people/hanwen/lilypond/index.html