News for hackers. Stuff that matters.
Re:Rob Pike: "Current Unix tools are weakened by the built-i... by anvandare on Thursday June 14, 2012 @03:21PM (#4113056)
Actually I've been considering/dreaming about a thing like this for a long while now (ever since I got started with jQuery and discovered how smooth I could sail through the DOM with it). The idea I came up with (I'm most likely not the first to think of it, so tell me if someone already implemented it) is a sort of JavaScript shell for *nix that'd work similar to jQuery: passing along (collections of) JavaScript objects with properties and functions.

e.g.:

  var sum = 0;
  $("~").ls({"type": "file", "size": ">1M"}).each(function () {sum += $(this).size("mb");});
  $.echo("total size of home directory: %d MB", sum);
Re:Rob Pike: "Current Unix tools are weakened by the built-i... by noblethrasher on Thursday June 14, 2012 @04:06PM (#4113280)
Powershell on Windows does something like what you want:

    PS C:\Some Directory $sum = 0
    PS C:\Some Directory dir | where { $_Length -gt 1MB } | %{ $sum += $_.Length }
Re:Rob Pike: "Current Unix tools are weakened by the built-i... by mey on Thursday June 14, 2012 @04:36PM (#4113401)
First thing I looked for when I checked the comments, was there a mention of Powershell. Powershell has the concept of passing objects (via .net clr) instead of passing strings. It sucks when trying to deal with streams of data, but fantastic for acting as script glue between various systems.

One of the things I feel Microsoft really got right.

Re:Rob Pike: "Current Unix tools are weakened by the built-i... by e12e on Thursday June 14, 2012 @06:00PM (#4113747)
First thing I checked for too. Second thing I looked for was someone pointing out that this is asking for object oriented systems (such as Smalltalk or Self).

But the third thing, no one mentioned: SNOBOL. Reportedly (because I haven't used it myself) it is better than AWK for complex matching.

Re:Rob Pike: "Current Unix tools are weakened by the built-i... by ori_b on Thursday June 14, 2012 @06:38PM (#4113899)
I played with SNOBOL. It may have a more powerful matching engine, but power doesn't equate to usability. Having each line followed by 3 gotos does not good UX make.
Re:Rob Pike: "Current Unix tools are weakened by the built-i... by jejones3141 on Thursday June 14, 2012 @09:16PM (#4114459)
Icon or its descendant Unicon might be worth a look, then.
Re:Rob Pike: "Current Unix tools are weakened by the built-i... by ori_b on Thursday June 14, 2012 @09:55PM (#4114552)
Maybe. I don't think I've ever really been constrained by the power of Awk's pattern matching. I wish I could do it recursively, but that's not so much a power issue as a composability issue.
Re:Rob Pike: "Current Unix tools are weakened by the built-i... by stcredzero on Thursday June 14, 2012 @04:02PM (#4113256)
Or, one could write a library of standard parsers and serializers for the Unix tools that would parse and produce known JSON representations of data that could be passed between scripts.
Re:Rob Pike: "Current Unix tools are weakened by the built-i... by zem on Thursday June 14, 2012 @04:16PM (#4113316)
i did something like that at my last job - the cluster manager was designed as a set of command line tools, and every program had a -j flag that would make it parse stdin as json and write json to stdout. we then wrote wrappers around all the linux utilities we were using, to enable the same behaviour. once the basic system was in place it let us experiment with new features very rapidly indeed because everything could be tested in isolation from the command line using automated test scripts. what was especially nice was that we could use the same test framework to chain several utilities together and test the combination, because it was all a black box with json going in and coming out.
Re:Rob Pike: "Current Unix tools are weakened by the built-i... by Evbn on Friday June 15, 2012 @02:39AM (#4115352)
That's recordstream
Re:Rob Pike: "Current Unix tools are weakened by the built-i... by stcredzero on Friday June 15, 2012 @09:08AM (#4116253)
recordstream seems to concentrate on lots of formats. Really, it should concentrate on lots of tools, with a shared repository of parsers for tools.

EDIT: Actually, they concentrate on JSON, but they also try to provide a generic set of tools for reading any format. I think this could be better structured to "just work."