News for hackers. Stuff that matters.
Re:An analysis of the C#/.NET platform by Touche on Saturday November 02, 2013 @03:43PM (#6660443)
Code example?
Re:An analysis of the C#/.NET platform by MichaelGG on Saturday November 02, 2013 @06:28PM (#6661119)
IMO the problem with bash piping is that it's just text streams. Which means you end up having to do all sorts of text manipulation tasks if something outputs a complex object. Compare to, say, PowerShell, which pipes objects along. You can treat them as a text representation, or operate on their properties without having to embed a little parser.

I'm not sure what about F#'s piping syntax (it's just reversed function application) blows bash away, though.

FWIW: F# ships a standard definition for the operator |> as "let (|>) x f = f x".

Hence you can do e.g. "123 |> write" instead of "write 123". In practise this leads to normal chaining of map/reduce and other list manipulations. In F#, this operator also gains attention as F#'s inference is left-to-right, so suppose you have a list of strings "xs". Without piping, you might write:

  let firstChars xs = Seq.map (fun (x: string) -> xs.[0]) xs
With pipeline it becomes:

  let firstChars xs = xs |> Seq.map (fun x -> xs.[0])
Re:An analysis of the C#/.NET platform by Touche on Sunday November 03, 2013 @01:19AM (#6662324)
Again, you are piping functions, not programs. Piping programs is important to shell scripting. This is actually very hard in PowerShell. I've written a few cmdlets; it is hard. And even harder for the user.
Re:An analysis of the C#/.NET platform by profquail on Sunday November 03, 2013 @02:34AM (#6662514)
Can you provide an example of some task which is easy in a shell script (sh) and difficult in PowerShell? Perhaps something related to piping?

I've written a few .sh scripts here and there and I use PowerShell occasionally; I'm nowhere near an expert in either though, so a concrete example would make it easier to understand your point about PowerShell being more difficult.

Re:An analysis of the C#/.NET platform by Touche on Sunday November 03, 2013 @11:28AM (#6663719)
Someone else provided an example of zipping a file.
Re:An analysis of the C#/.NET platform by Touche on Saturday November 02, 2013 @04:11PM (#6660557)
Both of those links require a browser plugin that I'm not going to install. From the url's I'm guessing this is about piping functions? I'm not asking about that, I'm asking about piping commands (programs), something any shell scripting language needs to be able to do.