Wed Aug 5 13:14:07 CEST 2009
Confused about primitives
This is ironic: the goal is to properly define primitives, but I'm
already getting hosed!
Once conclusion to draw: there is a set of C primitives that is best
written directly in the required API (sc ,object, ...) -> object
instead of in unwrapped C, because of the tight coupling with the data
representation. These _direct primitives_ are written manually.
In short: to keep things simple, the interpreter is written in terms
of primitive functions using all scheme datatypes (ala tinyscheme).
What cannot be avoided however is functions that convert between
scheme and C values (esp. strings<-> and ints). it's best to limit
the use however, and try to use as much as possible real scheme
primitives to avoid duplication (don't give in to premature opti
So, let's try it:
All C functions used in the implementation of the Scheme
interpreter are Scheme primitives.
This fixes the primitive calling convention to:
object fn(sc*, object, ...)
This will raise other problems since I'm not sure it's possible to
have variable argument invokation (assumed from Pure Data source).