Replies: 3 comments 6 replies
-
|
Fully agreed. When I originally saw Deno introducing them, it seemed foreign, compared to everything else built up thus far. |
Beta Was this translation helpful? Give feedback.
-
Couldn't you just as easily say people unfamiliar with the Unix terminology can look up the appropriate function calls for what they want? The Unix abstractions have been around for decades, and a lot of people are familiar with them. Often it makes sense to reuse abstractions instead of reinventing the wheel, because they'll pop up in other places too. Some of the Unix calls do have pretty wacky names if you haven't used them before, but I think Deno does a pretty good job of documenting the api, and node.js (which is what all server side javascript devs have been using for years) uses a very similar api. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm sure this breaks a lot of people's well-worn habits so apologies in advance - my intentions are pure! Don't hurt me!
The suggestion: Deno & other interpreters should stop using the C syscall names verbatim for the interpreter's exposed API function names (see: Deno.lstat).
We should absolutely still clearly document the underlying system calls being made in each Deno API function, to:
but the original names are bad, bad, bad names. They were chosen in an era with totally different considerations, where programs stored as text took up significant space, and weren't being compressed. Text editors didn't autocomplete, let alone suggest function names. The entire POSIX and C landscape is named this way and I'm sure most of us are even fond of the idiosyncratic names, but we need to acknowledge that almost all the names are awful. Even when they're a single valid word they're often not descriptive or intuitive (
fork/tee), some are arbitrarily truncated (exec), they have no word delimiters so you sometimes need to guess the intended words (flock), some of them are like weird half-acronyms (chown), and in the context of JS / Deno, they appear to the uninitiated as totally arbitrary exceptions to naming/style conventions (which is bad no matter what you think of the inherent quality of the POSIX names).Another advantage of abstracting away from the POSIX names is that it makes development more cross-platform in a human/social sense - if a dev's targeting Windows they don't even need to know the Linux or Mac internal names for things to use Deno fully.
To get the ball rolling:
stat/lstat/fstatcould be rolled into one function and exposed as something like:This way, you have
fileInfo()returning a FileInfo object - pretty straightfoward. We could even go implicit and name itstatus(),attributes()orproperties(), given almost every FS path points to some kind of "file". I think the majority of people would immediately understand "status/attributes/properties" refers to the file the given path refers to, rather than the path string itself.Beta Was this translation helpful? Give feedback.
All reactions