The more I think of this, the more utility comes to mind. I mentioned this deep in another thread - I mention it here for criticism/improvements before I suggest it as a feature proper.
The idea is to expose Codea’s Project/Tab structure as a filesystem, something Codea code could read/write/modify using io.* the same as Lua and the regular filesystem on a normal PC.
This would allow “data files”, where right now we need to make big data lua code, with the attendant overhead. Extra points for allowing “binary” tabs - the tab would show, perhaps, a name and a comment about it’s contents. Font data, game data, saved games, etc - it’s an alternative to project/global storage, in a place that’s visible and easily manipulated (which isn’t a feature of storage currently).
But - it would go farther; utility type scripts (I’m thinking things like lint and code checkers, or even refactoring scripts) could be run against code in other projects. Indeed, self referential or even self-modifying code is possible in this way (as it is with persistent storage today and load(), but again this would be much more transparent to the user).
This would also make dealing with libraries trivial.
f = require("Cube/Font")
if (not f) then
print "I'm sorry, I need Cube/Font to run - download it at BLAH BLAH"
end
(Hmm - can we make a call to generate a runtime error? I think we can, and should in that example, but I’m too tired to look it up).
And finally, it would allow for programs that generate useful output (something doing calculations, or a usage history - I’m thinking about code to do things like measure reaction time in an experimental setup) to put them somewhere where it can be exported to be used by other stuff, even via cut and paste. Right now, output is limited to print() (which i can’t cut/copy), the screen (again, no cut/copy), or persistent storage (where I could export a .codea project and hack it apart externally - very, very messy).
Files, as a concept, are insanely useful. Let’s use them.
(Note that NONE of this suggests writing directly to the iOS file system, or even to Codea’s Documents directory - things like plists and so on would be completely invisible).
Other than the time to implement, the only downside I can see of this would be a “rogue” project modifying another on-the-sly - that’s easily dealt with by making projects (other than the current one) read-only unless the user has removed the “write-protect tab” (a checkable option for each project, or each project/tab) explicitly.
Maybe this is useless because I forgot ________, or maybe it’s great but ________. or maybe it’s impossible because of _______. You fill in the blanks - I’m not proud, if this is silly, let me know.