why Unix?

Jesse Phillips jessekphillips at gmail.com
Wed Apr 8 08:11:07 PDT 2009


On Thu, 09 Apr 2009 00:10:29 +1000, Daniel Keep wrote:

> 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.

Ah, then the problem was using the term "everything is a file." $ ls is 
unrelated to that philosophy. "Everything is a file" refers to how you 
communicate to your kernel, not the tools used to manipulate files. That 
is you can open a text file and use a file descriptor, you open a socket 
and use a file descriptor.

Maybe it would have been better to use the *nix philosophy of "chaining 
tools together." I've never used powershell so I'm not familiar wit the 
alternative.



More information about the Digitalmars-d mailing list