code in cvs is broken
Linas Vepstas
linas@linas.org
Fri, 16 Nov 2001 14:15:38 -0600
On Fri, Nov 16, 2001 at 01:48:47PM -0600, Rob Browning was heard to remark:
> linas@linas.org (Linas Vepstas) writes:
>
> > No, I don't mean that .... My nightmare debug sceanrio is C code
> > that calls guile code that calls c code that calls guile code to
> > initialize c structs with who knows what.
>
> FWIW guile's supposed to be designed with the idea of playing nice
> with interleaving on the C stack so it should at least make some
> effort to DTRT.
I'm not really concerned that its somehow 'doing the wrong thing',
as the general malaise about making C code smarter than it desrves to
be. I'd rather keep the c code as dumb as possible, and have the
scheme code push it around like a wet noodle. Trying to make the
C code smart by using guile just seems like an invitation to trouble.
My gut-sense is based on old hardware ideas: chips rarely 'call back'
into microcode. Instead the chips are dumb, and the microcode pushes
them around. Similarly, kernel device drivers push around the
paddle cards. Similarly, user-space programs push the kernel around.
You very rarely have kernel extensions that call-back into user space.
In all these cases, its not that you can't do it, its that you don't,
usually because of stability & debugging issues. You want to convince
yourself of the robustness of the lower layer, no if's and's or but's;
that means that the lower layer should always have the simplest possible
design.
Similarly, having c code 'call back' into scheme just makes me queasy.
Id' like to have the C code just be simple, solid, trustworthy, and
something you can mostly ignore; not something you need to second-guess.
That means no magic down in there, no tricks, no stunts, just plain
boring straight-ahead crap.
There doesn't seem to be any strong technical reason for a call-back
design between c and scm in gnucash; in most cases, it seems that it
would be just as easy/quick/efficient to use scheme to push data into
the c code. Right?
Recall: the reason we had C code invoking guile was because the
gnucash main loop was in C. But now that it will be in scheme,
the proximate cause will be gone.
--linas
--
pub 1024D/01045933 2001-02-01 Linas Vepstas (Labas!) <linas@linas.org>
PGP Key fingerprint = 8305 2521 6000 0B5E 8984 3F54 64A9 9A82 0104 5933