Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

PowerShell's problem is it's so goddamn wordy and poorly documented. It reminds me of AppleScript, but far worse.


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


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


This may be interesting. Script languages generally aren’t typed but maybe a language with very good type inference may feel like it’s untyped.


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


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


Some things should not require an IDE? Powershell is a shell so it should be easy to type, no?


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


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


I'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>


Oh man. Somebody who really knows PowerShell. That's really rare :-)


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




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: