I sometimes get asked why the source of uLisp for each platform is in a single file. Wouldn’t it be better to divide it into a multiple file structure with .h files, with each logical set of functions in a separate .ino or .c file, like repl.h, eval.h, etc?
I tried working with this sort of structure, but I found it much less efficient to work with. That may be a consequence of the fact that I use the Arduino IDE; on Atmel Studio working with multiple files may be easier, but I’m on Mac which Atmel Studio doesn’t support. I use the convention that there’s a space before the bracket in function definitions, so it’s easy to find the definition of a function with a Find.
It’s also easier for users to install uLisp from a single file; there’s no setup involved, aside from double-clicking the .ino file.
For maintaining the different platform versions of uLisp I’ve thought about having a single multi-platform source, and using the C preprocessor to select the code relevant to a particular version. However, the C preprocessor is very limited, and it would cause the source files to get extremely messy and difficult to follow. Also, as there are some major differences between platforms, such as how save-image and load-image are implemented, the source would be much larger as it would have to include every variant.
What I have instead is a single set of master sources, and a program on my computer (written in Lisp) that puts together the correct source for a specified platform. I think that gives me the best of both worlds - I have one set of sources to maintain, but someone using uLisp on a particular platform only has the source code relevant for that platform in a single file of minimum size.
I’d welcome suggestions about how to improve this - David.