why Unix?
Daniel Keep
daniel.keep.lists at gmail.com
Wed Apr 8 07:10:29 PDT 2009
Steven Schveighoffer wrote:
> [snip]
>
> -Steve
This is getting rather inflammatory, so let me clarify a few things.
What Yigal should have said was that when everything is a file, there is
no API for the CONTENTS of files. Yes, you can manipulate files, but
it's a bit like Variants in D: you can't do anything useful with the
contents unless you specifically know what they are.
Powershell is designed to work with managed (.NET) objects. It can
dynamically introspect these objects and pull them apart, mutate them,
convert them, etc. Imagine if every file on a UNIX system also carried
around a reference to its own parser, and a description of how to
interpret the data. THAT is what Powershell has over UNIX shells.
For example, the output of the "ls" equivalent is a table of objects.
By default, it gets toString'd and displayed as a table. However, you
can pipe this into a command that reorders columns. Or sorts. And you
don't have to dick about with ensuring the filenames don't contain
whitespace or newlines because the file names are carried around as
actual strings that know their own length.
Unlike UNIX, where everything is a file, to powershell everything is an
object. So the list command can be used on a directory or on an object
that is an aggregate of stuff. For example, you can use powershell to
browse the registry as if it was just another part of the filesystem.
I won't say that "everything is a file" is a failure, but powershell
*definitely* exposes a superset of UNIX's functionality. Anything you
can do with a UNIX-style environment, powershell can potentially do better.
Microsoft really hit one out of the park with powershell, although it
remains to be seen if anyone will actually use it.
-- Daniel.
More information about the Digitalmars-d
mailing list