Io Namespacing
Namespacing in Io is just like building any other object, but the loader doesn’t make it entirely easy to split multiple objects under a namespace into separate files.
In a library I’m writing I wanted something like this, so I created an object called Library, which looks like
Library := Object clone do(
loadPath := nil
setLoadPath := method(path,
loadPath = path
self
)
forward := method(
name := call message name
path := Path with(loadPath, name .. ".io") asSymbol
if(File with(path) exists,
Lobby doFile(path),
resend
)
)
)
Then you can have parts of a namespace auto-load by setting them up with the loader:
HTTP := Library clone setLoadPath("lib/iou/http")
Io is pretty amazing, having a really good time with the projects I’m working on still.