News for hackers. Stuff that matters.
Re:“It's easier to port a shell than a shell script” (1998) by tatterdemalion on Sunday August 23, 2015 @05:05AM (#10105072)
I have never used PowerShell, so I don't know a lot about the details. But PowerShell pipes .NET objects from one command to the next, which are not just bytestreams but are objects, with methods and such. It's fundamentally different.

In UNIX, you have bytes, and the underlying system doesn't know what they represent. Most tools assume they're ASCII or UTF-8 (or whatever) encoded text, but that's all they agree on. In practice, you're working almost always working with structured data - tables or lists or mappings - but you have to remember that for the output of this program, you want to cut on '=' and take -f4, and first you need to pipe it through head and tail to clean up some junk output[1], and this other thing for that program, and whatever.

[1] This is a way to get the `time` field from the output of `ping`.

Re:“It's easier to port a shell than a shell script” (1998) by integraton on Sunday August 23, 2015 @12:19PM (#10105864)
> It's fundamentally different.

That's because the object pipeline is functionally analogous to function chaining within a single runtime like in Python or Ruby, not streaming data between arbitrary executables like in Unix pipelines.

This would be a lot clearer if PowerShell advocates compared it to things that it's actually functionally analogous to, but they are trying to position it as a Unix shell competitor.

Re:“It's easier to port a shell than a shell script” (1998) by useerup on Sunday August 23, 2015 @02:16PM (#10106270)
> That's because the object pipeline is functionally analogous to function chaining within a single runtime like in Python or Ruby

No it is not. See my response below.

[dead]
Re:“It's easier to port a shell than a shell script” (1998) by useerup on Sunday August 23, 2015 @03:24PM (#10106461)
> You are the same person who tried to falsely claim that cmdlets are not instances of .NET classes

The fact stands, cmdlets can be implemented as .NET classes, but they can also be implemented through script (i.e. not .NET classes) or through manifests where cmdlets are generated for WMI/CIM classes.

I don't know why you continue to ignore this, or even why it is important. I point out that you are incorrect and point to a authoritative source that demonstrate the point.

The relevant section of the PowerShell section:

--- ... A module can contain one or more module members, which are commands (such as cmdlets and functions) and items (such as variables and aliases). The names of these members can be kept private to the module or they may be exported to the session into which the module is imported. There are three different module types: manifest, script, and binary. A manifest module is a file that contains information about a module, and controls certain aspects of that module's use. A script module is a PowerShell script file with a file extension of ".psm1" instead of ".ps1". A binary module contains class types that define cmdlets and providers. Unlike script modules, binary modules are written in compiled languages. Binary modules are not covered by this specification. Windows PowerShell: A binary module is a .NET assembly (i.e.; a DLL) that was compiled against the PowerShell libraries. ---

I will point out when your claims about PowerShell are incorrect. It's an opportunity to learn something. Please address the topic, not the poster.

[dead]
Re:“It's easier to port a shell than a shell script” (1998) by dang on Monday August 24, 2015 @12:53AM (#10107972)
Your comments have been crossing over personal attacks. That's not allowed on HN. Please post civilly or not at all.
Re:“It's easier to port a shell than a shell script” (1998) by useerup on Sunday August 23, 2015 @05:36PM (#10106826)
> Then those generated cmdlets must be instances of .NET classes, because by definition that's what cmdlets are

Nope. The problem is that you searched for confirmation that cmdlets was "just" .NET classes (I really don't get why that is important), and then you dive into documentation for C# programmers and point out how the documentation for C# programmers is telling the C# programmer that if he wants to create a cmdlet he can do it with a C# class. D-oh!

When I point to the PowerShell specification and demonstrates how it does not claim that cmdlets are .NET classes you ignore it.

I point out how it enumerates the 3 different ways to make cmdlet modules: Binary, script and manifest, of which only the binary module variety implement cmdlets as classes.

You could equally well claim that Web Services are just MVC Controllers, because in the documentation for MVC I can find out how to implement web services using MVC controllers.

> ... and they exist within the .NET runtime, which is the relevant issue

Why? If the .NET runtime has become sediment to the point where the OS is always distributed with the runtime, where important OS functions (like troubleshooting) is implemented using the runtime, where remote administration is based on the runtime, at what point do you accept the runtime as part of the OS?

.NET IS part of Windows now, has been since Windows 7 SP1 (IIRC). Troubleshooting packs, guides etc. are written using PowerShell. When your network gets the hiccups, and Windows proactively offers to troubleshoot the network connection, it is PowerShell that is running underneath. The new PackageManager is PowerShell based.

> Thank you, however, for providing yet another demonstration of how PowerShell advocates consistently resort to handwaving, obfuscation, and false claims in order to try to pretend PowerShell is functionally different than it actually is.

No need for snide remarks. I stand by all of my claims. It is you who selectively quote C# programmers documentation out of context. All you have proven is that if a C# programmer wants to create a cmdlet using C#, he must implement it using a class.