This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: guile bugs
- To: Mikael Djurfeldt <mdj AT mdj-pc.nada.kth.se>
- Subject: Re: guile bugs
- From: Miroslav Silovic <silovic AT zesoi.fer.hr>
- Date: 16 Sep 1999 12:48:16 +0200
- Cc: Greg Badros <gjb AT cs.washington dot edu>, Jim Blandy <jimb AT red-bean dot com>, Jay Belanger <jay AT vh213601.truman dot edu>, scwm-discuss AT scwm.mit dot edu, guile AT sourceware.cygnus dot com, djurfeldt AT nada.kth.se
- References: <qrru2oyxtr7.fsf@elwha.cs.washington.edu> <199909141442.JAA17962@vh213601.truman.edu> <qrraeqpy0pl.fsf@elwha.cs.washington.edu> <199909141624.LAA19039@vh213601.truman.edu> <qrrlna9w5az.fsf@elwha.cs.washington.edu> <199909142309.SAA01374@vh213601.truman.edu> <qrrvh9bu8rp.fsf@elwha.cs.washington.edu> <m34sgvcttc.fsf@savonarola.red-bean.com> <qrrvh9bl8ix.fsf_-_@elwha.cs.washington.edu> <xy7vh9bi4ed.fsf@mdj-pc.nada.kth.se>
Mikael Djurfeldt <mdj@mdj-pc.nada.kth.se> writes:
> > 1) SCM_BOOL_F should be 0 so it is false in C
>
> I don't like this argument. It's not true that this change would
> eliminate bugs. Using SCM values directly in C is a violation of the
> abstraction barrier and clearly a bug. The suggested change would, in
> fact, multiply them. It would make code with this type of bug work,
> so that they are harder to find.
I fully agree with the above sentiment, however, it's not the main
problem. The main problem is that C compiler won't report errors like
if (scm_procedure_p(foo))
...
It won't even complain about them.
I think SCM should be
typedef union {
void *ptr;
long value;
float float_value; /* for CDR parts of float pairs */
} SCM;
Now /this/ would trap most bugs. But I'm not sure about the efficiency
issues (gcc may overoptimize functions returning SCM structs, and use
pointers rather than registers... This should be investigated). It
would also trap problems such as
*(Foo_smob*)SCM_CDR(foo) = whatever
(rather than SCM_SET_CDR(foo, whatever))
- while these expressions are equivalent with the current
implementation, it could bomb with write barrier in place.
--
How to eff the ineffable?