A.) No philosophy. So, it was designed by a committee; at least it's honest.
B.) chose names consistent with a literate naming philosophy, similar
to Java and its progeny:
makeDirectory
remove
removeTree
list
listTree
changeDirectory
changePermissions
listPaths
listTreePaths
C.) chose names consistent with this the Unix naming philosophies
(using C or shell naming conventions where apt):
mkdir
rm
rmtree
ls
lstree
chdir
chown
chmod
lsPaths
lstreePaths
D.) mostly Unixy, except use "list" and "remove" literately.
mkdir
remove
removeTree
list
listTree
chdir
chown
listPaths
listTreePaths
E-Z+.) Your ideas here.
I've left out "mtime" since we've already arrived at consensus on that
one, but it's worth pointing out that it is in the Unixy camp, so
compatible with C and D philosophically.
I've also left out "mktree", "mkdirs", "mkpath", or "mkwhatever",
since I don't think we've arrived at a consensus on that name. I'm
favoring "mkdirs" against 1 dissenter.
I'm proposing the addition of *Paths for functions that return Arrays
of Path objects instead of Strings. I experimented with just one or
the other (always returning Paths or always returning Strings), but
both turned out to be useful.
Also, regardless of the convention, we should add "glob" and "globPaths".
Kris Kowal
Hey Wes, how come you get five votes? ;)
B too.
--
Cheers,
--MarkM
I'm a fan of succinctness, and Unix, but B seems like it will be
easier to keep consistent across the board.
B
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name]
B.) chose names consistent with a literate naming philosophy, similar
to Java and its progeny:
require('posix.js');
shell = new POSIX();
array_of_files = shell.ls(path);
Maybe I am a looking too deep into your example and missing the point but I would like to see libraries that control these names...For instance a POSIX library when included should yield unix style names...Without a library, I don't believe you should be able to list files or make directories. You will need to read files to load the library you want but that is about all of the file system stuff that should be baked in.I agree that consistency is important but I want to see a very limited scope baked in. However, I would love to have a POSIX library and then I would expect functions like ls() & mkdir() & ln()So if I had to vote on the purposed options I would choose B because I wouldn't want to see a command so short as 'ls' being a reserved word but I would love to do something like:require('posix.js');
shell = new POSIX();
array_of_files = shell.ls(path);Thus I propose verbose function names for stuff that is baked in but nice standard libraries that would have function names that you can predict.
So if I had to vote on the purposed options I would choose B because I wouldn't want to see a command so short as 'ls' being a reserved word but I would love to do something like:require('posix.js');
shell = new POSIX();
array_of_files = shell.ls(path);
Ken Thompson was once asked by a reporter what he would have changed about
Unix if he had it all to do over again. His answer: "I would spell creat
with an `e.'"
From: comm...@googlegroups.com [mailto:comm...@googlegroups.com] On Behalf Of Wes Garland
Sent: den 31 augusti 2009 20:59
To: comm...@googlegroups.com
Subject: [CommonJS] Re: Filesystem API - Hobgoblin of little minds in little bike sheds with little bicycles
There are a lot of votes for *individual* function names in the Unix style. [1]
Kevin showed his hand "mkdir" and "mkdirs".
Wes showed his hand for "unlink".
Mario Valente showed his hand for "stat".
Tom, Kevin, and Ondrej have hands shown for "mtime", "atime", and "ctime".
If I went ahead with B for another draft, these would be named
"makeDirectory", "makeDirectories", "remove", and "lastModified".
"stat", "atime", and "ctime" don't have platform independent analogs,
but I would probably have different names for these too.
Before proceeding with a draft based on philosophy B, I would think we
need to hear from Kevin, Tom, and Ondrej at least. We haven't heard
much from Mario lately, but I'd like to hear his opinion too. Also,
Wes, as you've already shown support for B, I'd like hear whether you
feel this consideration should override your previous preferences. I
think we also need support from at least Hannes, Kris Zyp to proceed.
Kris Kowal
Kevin showed his hand "mkdir" and "mkdirs".
On the subject of stat, I was thinking that perhaps stat should only
contain entries for the metadata that can be reliably gathered cross
platform (i.e. particualrly not deviceNumber etc.), and move those
extra fields into say, |require('posix').stat('file')| so that code
has to make a conscious choice to not be portable across platforms?
Thoughts?
Also can someone explain to me the reason why Path ctor takes a FS
object? And an actual use case of this feature, since I can sort of
see why, I think.
On Mon, Aug 31, 2009 at 8:39 PM, Kris Kowal <cowber...@gmail.com> wrote:
>
> There are a lot of votes for *individual* function names in the Unix style.
> [1]
>
>
> Before proceeding with a draft based on philosophy B, I would think we
> need to hear from Kevin, Tom, and Ondrej at least. We haven't heard
> much from Mario lately, but I'd like to hear his opinion too.
>
Thanks for calling me out of lurker mode Kris :)
I've been busy, but I've kept up with discussions, at least on reading
mode. Most of the time I just feel that the stuff you guys discuss is
way over my head and I dont think that I would have anything of value to
add, especially since most of the time there's someone else that states
what would be my opinion but does so in a much better way than what I
would have been able,
On the subject at hand: I would definitely prefer all File/IO ops to be
Unix/C/POSIX oriented. I'm just used to them and feel that they are more
succint (ie. less typing). I do hate the verbosity of Java; but like
someone
else said, I wont hold that grudge over the advantage of having a
structured
architected API.
So that means I surely support the overwhelming B choice, even in the
case of stat :-)
But like Joshaven I would prefer that the stuff baked in would be as
least as possible, allowing for the later creation of libraries (namely a
POSIX one :-)
-- MV