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] |
Greg Badros writes: > > > <For the guile list that I'm now cc'ing, this is a thread from > scwm-discuss about avoiding bugs where a long/int is used where an SCM > was meant to be used -- inspired by a hard-to-find bug in Scwm due to > SCM being typedefed to long> > > Maciej Stachowiak <mstachow@mit.edu> writes: > > > Not all SCMs are actually pointers, characters and integers up to 30 > > bits are stored directly in that word, with a type tag. One could come > > up with an assertion based on the possible values of the type tags, > > but this would be pretty complicated. Is that the difference between IMP and NIMP that has to be observed when writing typechecks for wrapper code? > > Which is why we have abstractions like macros and functions. From a > quick look at tags.h, it looks as though the valid SCM values are sparse > enough and well-defined enough that perhaps a macro for validating SCMs > could be written. Then asserting the validity of all SCMs at function > calls in a debug build might help catch some errors dynamically. > Obviously I'd prefer a solution that got us this statically, but it > sounds like that would require more pervasive changes to guile. How is it solved in other scheme implementations? Klaus schilling