namespace.lsp adds java-like namespaces to newLISP!
You can do stuff like:
(ns-import 'com.example.*) (ns-import 'com.example.Test)
To understand what this is and how it works just follow these steps:
- Run main.lsp in the project directory:
[prompt]$ newlisp main.lsp
- Read main.lsp
- Look at the directory structure in src/
- Look inside Bar.lsp, Foo.lsp, and Test.lsp.
- Learn about Objective newLISP if you haven't already, but this is optional! you don't need to use ObjNL with namespace.lsp if you don't want.
For an even deeper understanding of how it works, look at ns-create and ns-import in namespace.lsp. There's only 2 short functions to get this functionality! The rest is just making sure your directory structure follows the "package path".
I.e. if you've got a context Test and its package path is: com.example.Test Your Test.lsp file should be inside com/example.