4 ms·
I have had the (dis)pleasure of learning PowerShell pretty well in the last few months and from that experience I believe forcing different things into the same
by maxxxxx 7y ago
I have had the (dis)pleasure of learning PowerShell pretty well in the last few months and from that experience I believe forcing different things into the same model doesn't really work. When I read something like "New-Item" I have to take another look and see what it really deals with. Maybe some people think it's "elegant" but I don't agree. It's not like everything that's returned by "New-Item" behaves the same way. .NET is doing it better with static methods like "File.xxxxx" and "Directory.xxxx". You know immediately what you are dealing with.
- bayareanative 7y agoPowerShell's problem is it's so goddamn wordy and poorly documented. It reminds me of AppleScript, but far worse.
- maxxxxx 7y ago"It reminds me of AppleScript, but far worse." I wouldn't go that far :-). But you are right. They did good work with the cmdlets but they put a terrible language on top of them. It would have been much better if they had put an interpreted version of C# (maybe with a few extensions) on top of it.
- carlmr 7y agoAgreed, I think F# which already has an interpreter would have been a great and obvious choice. Terse Syntax, amazing type inference, and a great existing community.
- maxxxxx 7y agoThis may be interesting. Script languages generally aren’t typed but maybe a language with very good type inference may feel like it’s untyped.
- carlmr 7y agoYou mostly don't need types in F#, although types often add readability, especially for function signatures (IMHO). F# will even compile let add a b = a + b add 1 2;; as val add : a:int -> b:int -> int val it : int = 3 or let add a b = a + b add 1ul 2ul;; as val add : a:uint32 -> b:uint32 -> uint32 val it : uint32 = 3u So it will even infer type from the first usage of the function.
- Riverheart 7y agoToo each their own. With an auto completing IDE and aliases I've never found wordiness to be an issue. Certainly helps when you or others need to read it again. Don't find the documentation lacking either. Even if you do, anything you can do or have access to in C# can be replicated in Powershell.
- vkazanov 7y agoSome things should not require an IDE? Powershell is a shell so it should be easy to type, no?
- Riverheart 7y agoThe shell has auto complete as well and most of the commonly used cmdlets have aliases for shell usage if you don't want to rely on auto complete. You can also create aliases if you so desire. Edit: The side benefit of the verbosity is the discoverability of less used commands. Is it groupadd or addgroup? No question in Powershell, it would be Add-Group because of the Verb-Noun standard. Bash has all sorts of inconsistencies that require look-up if you don't use those commands often.
- maxxxxx 7y agoI think Powershell made a big mistake going with verb first. I know I want to do something with group but when I type group there is no auto complete. Now I type “add” and I get dozens or hundreds of suggestions which makes auto complete almost useless. They should have gone with target object first so when I type in group I get all the relevant auto complete suggestions.
- Riverheart 7y agoI'd suggest the following. get-command add*group* Or for brevity gcm add*group* For reference, the Bash version is this: compgen -c | grep group Edit: Let's get crazier. You want custom tab completion to focus on the command's noun plus Bash style completion. $Function:OriginalTabCompletion = $Function:TabExpansion function TabExpansion($line, $lastWord) { if ($line -match ('^!(.*)') { $lastWord = $lastWord.trimstart('!') Get-command -noun *$lastWord* } elseif { OriginalTabExpansion $line $lastWord } } Set-psreadline -chord tab -function MenuComplete !group<TAB>
- OJFord 7y agotell system to tell browser to tell tab with name 'HN' to tell comment with name 'bayareanative' to click button with name 'reply' and ... Oh hell.