Naming in tjs
& subscoping
#539
Replies: 3 comments 9 replies
-
Sorry it has taken me this long to provide feedback 😅 This is a tough one. Over time I have experimented with different approaches, buckle up. Before I built txiki.js I built another engine using Duktape with a module system similar to Python: https://sjs.readthedocs.io/en/latest/modules.html I liked it, but it gets annoying to have to import from like 5 namespaces for a simple script, specially since we are building a "small" runtime. ALso sometimes it's not 100% clear where some API needs to go and feels out of place everywhere. Then, when I built txiki.js I wanted to try and do things simpler. Deno existed already, and I won't deny its influence. Initially I went with just 2 namespaces: core and stdlib, with core being what the runtime provides, and the stdlib are nice batteries included. But also felt weird to use to I split it into what you see today: d13987e Before that, I tried namespacing the stuff in the If I think back, the reason why I likely went away from namespacing things is probably because there is always another way to organize them. Do we call it Last, both Deno and Bun have somewhat "proved" to me that a flat namespace has its benefits, and the arbitraty distribution of APIs in namespaces has no clear benefit to me. |
Beta Was this translation helpful? Give feedback.
-
Moving from the other dicsussion:
What do you mean by this one?
What would those be? Making things consistent there would make sense indeed.
Yes, this can be fixed!
Yeah, I agree, things should be better documented 😅
What's the issue with versioning? Right now there is zero guarantee about backwards compatibility. As you might have noticed, not everything is cast in stone. If you are only using web APIs you should be fine, but the I feel like this project is small enough to not need strong versioning and API guarantees yet, since I am still figuring stuff out all the time, there is no master plan here :-) If / when the core APIs have been stable for long enough that it makes sense to make some guarantees / promises, I'd be happy to do that! |
Beta Was this translation helpful? Give feedback.
-
Started some small steps in #583 |
Beta Was this translation helpful? Give feedback.
-
As a follow-up of the discussion in #538.
Aside from this proposal, having a sub-namespace of tjs like
tjs.posix.
and covering (exclusively) all POSIX apis as close as possible would be great. However, for general usage, and for everything that is not POSIX, the interface could be simplified an regularized a lot.Beta Was this translation helpful? Give feedback.
All reactions