4 ms·
They clearly know about PowerShell. They acknowledge it as an inspiration and the core concept is the same. That doesn't mean there aren't ways to improve upon
by kjksf 7y ago
They clearly know about PowerShell. They acknowledge it as an inspiration and the core concept is the same.
That doesn't mean there aren't ways to improve upon PowerShell.
As a light user of PowerShell I consider it a poor implementation of a great idea.
Commands are way too long, control structures have poor syntax etc.
To make this very concrete, take this example from nu:
ls | where size > 4kb
Now give me an equivalent in PowerShell and then let's talk about how different Nu is from PowerShell.
- chokolad 7y agodir |where length -gt 4kb Let's talk.
- dragonwriter 7y agoThe equivalent, btw, is: ls | where length -gt 4kb The only difference is powershell uses “>” and “<” for redirection, and so uses mnemonic operators for comparisons. Nu doesn't seem to support redirection (or even have anything other than one input and one output stream, though metadata might serve the purposes otherwise served by additional streams; it's not how a program would return something Nu would treat as metadata, though.) I guess that with a structured-data shell, error type of info could just be returned in-band under a different tag, in any case.
- hobs 7y agoComplaining about command length when PS explicitly had full fledged named commands (for readability) and default aliases (for terseness) doesn't make sense imo.
- jodrellblank 7y agoTake your pick: # most common in script, vs at shell Get-ChildItem | Where-Object { $_.Length -gt 4kb } gci | where length -gt 4kb # longest most restrictive with namespaces, # most stable over time, # least risk of hitting the wrong command # or wrong property as surroundings change Microsoft.PowerShell.Management\Get-ChildItem | Microsoft.PowerShell.Core\Where-Object -Property Length -gt 4kb # shortest(?) gci|? le* -gt 4kb # because you can switch(gci){{$_.length-gt4kb}{$_}} gci | & { process{ if($_.Length -gt 4kb) { $_ } } } $larges, $smalls = (gci).where({$_.length -gt 4kb}, 'split') [linq.enumerable]::where([string[]][io.directory]::EnumerateFiles($pwd), [func[string,bool]]{param($f) [io.fileinfo]::new($f).Length -in 0..4kb}) In Powershell you can tab complete "Length" in the filter, from the available properties of the objects coming out of gci, which is neat.