[r6rs-discuss] Case sensitivity
eli at barzilay.org
Tue Feb 24 02:08:36 EST 2009
On Feb 23, Guillermo J. Rozas wrote:
> >> And why would I do that? Because, presumably, I don't want to
> >> re- type the definitions of the library that are already included
> >> in a .h file, and I'd rather write a tool that can be used and
> >> re-used as the .h file changes, than have to fix things by hand.
> > (That is a perfectly fine job for a macro, BTW.)
> Parsing a .h file? Boy, I've written hairy macros in my life, but
> that's got to be a winner.
I don't see why this would be hairier than writing code that parses a
header file... After all, this is Scheme, and macros are written in
Scheme. (Assuming that you're not restricted by a `syntax-rules'-only
One example is PLT's interface to OpenGL -- it has a macro that writes
a small C file, compiles it, runs the result, and eventually expands
into Scheme code that can now use that information. (And BTW, I
intend to write a macro to write those kinds of macros, and even that
wouldn't be too difficult.)
This approach has been used in several other cases; the most recent
notable example that I can think of was a similar thing that was done
in Larceny (there the C program writes information about offsets of
fields in C structs).
> >> As part of that pre-processing, it would examine all the
> >> identifiers, and report any conflicts.
> >> I doubt that there would be many if at all.
> > So in the case I describe above, it will break...
> No. It will produce a correct output.
Let me repeat it: the original bindings are "foo" and "Bar", since
this is all you have, you're likely to go for the simple translation
to `foo' and `bar'. Later on the library is extended with a "FOO",
and the produced code is no longer valid, since it's missing a proper
translation for an all-caps name. *Or* you make the generator detect
such cases and adapt -- in that case, the generator saw no clashes
before and gave you `foo' and `bar', and now that there is one, it
does some automatic tweaking -- thereby breaking existing code.
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://www.barzilay.org/ Maze is Life!
More information about the r6rs-discuss