views:

53

answers:

1

I am new to the dynamic languages scene, and trying to find a good starting point.

Looking at how Microsoft is diminishing the role of Iron Ruby in its offerings, I am looking around for a dynamic programming language that will be supported on dotNET platform. Could you list specific features that are found in one but not the other, to assist in the selection.

+3  A: 

PowerShell is primarily a Windows Automation tool that surfaces its functionality in a couple of ways:

  1. A shell (console) ala KornShell, CSH, BASH.
  2. A dynamic scripting language.
  3. A hostable engine ala TK/TCL & Windows Scripting engine.
  4. Underpinnings for the Windows 7 Troubleshooting Framework.

I view languages like Python and Ruby as general purpose languages, that while they may offer REPL prompts, aren't as suited to shell programming i.e. easily firing off system commands and EXE's, capturing stdin/out, dealing with non-terminating vs terminating errors, etc. That's where PowerShell shines.

OTOH, I wouldn't use PowerShell for all generic programming tasks. It can't:

  1. Define .NET types (except those that are of type PSCustomObject)
  2. Implement an interface
  3. Implement anything generic
  4. Can't call generic methods
  5. Doesn't support static extension method calling syntax e.g. array.Where()
  6. Doesn't support notion of namespace import (i.e. using system; in C#)

Like the old saying goes, be sure to pick the right tool for the job.

Keith Hill
Judging from your comments, if MS wanted to cover all bases, they'd need to be actively developing a dynamic language. For now we have to be glad there's dynamic keyword in C# 4.0.
GregC
http://stackoverflow.com/questions/3484232/would-you-recommend-iron-ruby-iron-python-or-powershell-for-making-a-c-applic
GregC
But VB has been dynamic for years, right? What, you don't consider that a "real" language? :-)
Keith Hill
There has been a time when perhaps 90 % of all Windows applications were written in VB ;-). Like 10 or 12 years ago. And back to your post, Add-Type is of great help in that regard. However, it's not a "pure" PowerShell solution anymore, then. And `array.Where()` can easily be done with native PowerShell with `$array | Where-Object {}`, though.
Joey
Agreed on LINQ-like nature of PowerShell Where/Select/etc. However, there are other generic and/or static extension methods that would be nice to be able to call - Enumerable.Join/Intersect/etc.
Keith Hill