4 ms·
At the top of the page, Ben writes that he's a "Functional Programming Enthusiast", so he'll at least have a vague familiarity with Scheme and similar languages
by DonaldFisk 6y ago
At the top of the page, Ben writes that he's a "Functional Programming Enthusiast", so he'll at least have a vague familiarity with Scheme and similar languages, even if he doesn't use them.
S-expressions are a widely used standard data format and are not exclusive to Lisps. If this is just to read in configuration files, and the resulting data structures never change after they're read in, he can get away with using calloc instead of a garbage collector, and null-terminated char * C-style strings.
Lisps (including Scheme) have more heavyweight implementations of strings and symbols than Ben has here, with an extra level of indirection: a symbol's name slot points to a string struct, which contains a pointer into an array of chars and a length. He can get away with a null-terminated char * and a struct containing an enum to distinguish them. For Lisp programming, the extra complexity is essential but for reading a config file into a game written in C, it's accidental. I don't know what kind of game he's writing but presumably it isn't anything like Abuse or Crash Bandicoot.
In the first paragraph, he writes, "I turned away from XML because I'd rather be as library independent as possible." This implies that he might have considered embedding a Lisp but decided against it for the same reason.