On 21-12-2011 05:51, Manfred Nowak wrote:
Just looked at index.html of D and got stuck onwriteln("Hello World, Reloaded"); // auto type inference and built-in foreach foreach (argc, argv; args) { // Object Oriented Programming auto cl = new CmdLin(argc, argv); // Improved typesafe printf writeln(cl.argnum, cl.suffix, " arg: ", cl.argv); // Automatic or explicit memory management delete cl; } With the pipe-syntax of shells ( sh, bash, ...) this five lines could be written as: "Hello World, Piped" | writeln; args | CmdLin | {argnum, suffix, " arg: ", argv} | writeln; Comments? -manfred
You could have a look at the pipe template in std.functional. But in general, I agree; a sort of piping operator would be very useful in algorithmic code. I find myself using the "|>" operator often in F#.
- Alex
