Power Shell

In November 2007 , MicrosoftCorporation released PowerShell CTP Version 2.0, an alternative to their ancient DOS command shell cmd.exe. It was code-named "Monad" during development, reflecting its exposure of FunctionalProgramming constructs to the user. To use the graphic version, one must have installed dotNetFramework 3.0. It will run in Microsoft XP Command-Line mode with dotNetFramework 2.0.

The syntax ditches most of the relics of .BAT file syntax for the UnixShell equivalents ( '-' for flags, '$' for variables, '|' to connect commands). Unlike UnixShell, the pipe operator doesn't pass data between processes via untyped byte streams, instead it passes COM objects between "commandlets", possibly running in the same process. Example:

 Get-Process WINWORD | Get-Member -MemberType Property | Format-List | Out-File WordProps.txt

which puts a list of process properties in the file, formatted like this:
 ...

TypeName : System.Diagnostics.Process Name : MachineName MemberType : Property Definition : System.String MachineName {get;}

TypeName : System.Diagnostics.Process Name : MainModule MemberType : Property Definition : System.Diagnostics.ProcessModule MainModule {get;}

...



Wish list for features (cmdlets) still needed:


I perused briefly some of the documentation that was linked to, but didn't study it in depth -- I just don't have the time. However, I'm interested in knowing what aspects of PowerShell make it "functional?" So far as I could tell, I couldn't see anything which amounted to traditional "functional" concepts. Thanks. --SamuelFalvo?

''Seems more "pipe-oriented" than "functional." Individual commands seem to work as function calls -- but that wouldn't make it a FunctionalProgramming language. Maybe they mean "functional," in the dictionary sense of "this product is capable of working correctly."! ;-> -- JeffGrigg

http://dictionary.reference.com/browse/functional

It extends to Objects the management options which formerly existed only for fileSystemObjects.


PowerShell CTP Preview 2.0 Released 20071107


CategoryFunctionalProgramming CategoryScripting


EditText of this page (last edited November 7, 2007) or FindPage with title or text search