This is the mail archive of the
guile@cygnus.com
mailing list for the guile project.
Re: implementing data tags via object properties -- help with debugging?
I guess you are right. I may as well use global variables (in the form of
"static", local in each file). Eventually, the right thing would be for
each procedure to take a "Library" as an argument -- the "global" space
(such as it is) would then be relegated to the Scheme world in that case.
By the way, I did look in the PGRT and it does use global variables (like for
Display, etc.). So, I suppose, with embedding, this may be a necessary
evil.
Thanks for your help, all!
> From: thi <ttn@mingle.glug.org>
> Date: Fri May 7, 10:13am
>
> robertb@continuumsi.com writes:
>
> > > one immediately apparent problem is using `gh_eval_str'. you
> > > probably want to simply save the return value of
> > > `gh_new_procedure', an SCM.
> >
> > Well, doing that defeats the purpose of trying not to have global
> > variables! Perhaps I was too idealist to believe that I could avoid
> > use of global variables in Guile. It was so easy in X-Windows!
>
> in your example, does this code
>
> gh_set_ext_data(gh_new_procedure1_0("ReadSymbols", ServerReadSymbols),
> (void*)lib);
>
> get called multiply? each `gh_new_procedure1_0' call returns a new
> procedure object.
>
> `ServerReadSymbols' is already global in the C function namespace and
> "ReadSymbols" is already global in the string pool. you are starting
> with global data and then calling a function that gives you a new
> pointer each time called. probably you will want to emulate libguile
> practice of making `ServerReadSymbols' file static and then in the init
> procedure (called only once), saving the SCM. then you can pass this
> SCM around w/ resorting to `gh_eval_str' (which consults yet another
> global namespace...).
>
> thi
> From: Greg Harvey <Greg.Harvey@thezone.net>
> Date: Fri May 7, 2:47pm
>
[message discarded]
>
> --
> Greg
--
Robert Brown | Continuum Software, Inc.
email:robertb@continuumsi.com | 800 West Cummings Park, Ste 4950
http://www.continuumsi.com/~robertb | Woburn, MA 01801-6504
voice: 781-932-8400 x100 | fax: 781-932-2558