PowerShell Complexity

By Xah Lee. Date: . Last updated: .
love-powershell
〔image source http://turnoff.us/geek/love-powershell/, © https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode

PowerShell Complexity from DOTNET Object System

PowerShell is based on DOTNET Object system. 〔see PowerShell: Object Type, Properties, Methods〕 This is a big source of its complexity, because, since each value is an object, it means they have methods. So, computation are done by method call syntax obj.met(). But this make it very inconsistent with many shell syntax and way of operations.

For example, a string, can be split to a array in the following ways

For example, here's how to create a ordered hashtable.

$dict = [ordered] @{"a" = 1; "b" = 1; }

The [ordered] there, is not a dotnet syntax proper, nor typical PowerShell. It is a PowerShell added syntax.

For example, here's how to create a array of int.

$myar = [int[]]::new(3)

There is no other way except this. It involves, dotnet type, casting, and dotnet static method.

So, you have a bewildering complexity of syntax, and burden on user about which one is the correct choice.

PowerShell Complexity

pwsh object error 2022-06-13 gQDFk
pwsh object error 2022-06-13 gQDFk

Been coding powershell kinda semi seriously for a year now. I'd say, it's fairly complex. Far more so than golang, python.

It's complex for 2 major reasons, i think. One is that, the whole thing work on objects, each is object a DOTNET object hierarchy. As opposed to unix just strings.

Programing Language Love and Hate