On 6/9/06, Louis J Scoras <louis.j.scoras / gmail.com> wrote: > > At 17:21 09.06.2006, James Edward Gray II wrote: > > >I wouldn't be so quick to dismiss the value of shell scripting > > >languages. They target a different problem space: gluing programs > > >together. It's easy to write shell scripts using redirection and > > >pipes that would be significantly bigger when translated to Ruby. > > > > > Precisely as James said. This is part of the Unix Philosophy and > what makes command-line interfaces so powerful. Well behaved programs > can be used in pipelines to do far more than their creators originally > intended. > > On 6/9/06, Kyrre Nygard <kyrreny / broadpark.no> wrote: > > You're making a good point here. But to me it feels like a "if it works > > don't fix it" kind of thing. I mean, all in all, wouldn't Ruby prevail? > > > > Feel free to show me some examples though. > > # mp32ogg [untested] - quick and dirty conversion: > mpg321 -w - somesong.mp3 | oggenc -o somesong.ogg - Though one day perhaps: require 'mpg' require 'oggenc' print Ogg.convertMpeg(Mpg.new("somesong.mpg")) > > Also, what if this operating system were to use a Ruby shell? > > I believe this has been tried w/ several different languages before. > You could do it, but it's not awefully convienent because most general > purpose languages weren't designed for this (i.e.: they can't be typed > as quickly). I have been messing around with Rush and believe that a Ruby shell could be quick and extremely useful. One idea that Reyn (the original author) mentioned was the ability to pipe objects around instead of just binary streams. So if piping syntax was easier, you could have the equivalent of the above looking something like this: Mpg.new("somesong.mp3") | Ogg.convertMpeg > new.ogg Each method on the right side of the pipe then has a attr_writer called "stdin" or some such and the interpreter assigns it to the object on the left before executing the method. Just ideas, but it could be really useful. Consider the age-old problem of a new unix program suddenly producing a slightly different text output, breaking many shell scripts. If the script rather depended on Df["/usr"].size instead of cutting up the text output from the "df" program and hoping it still looks the same (or using df -P), these scripts would be more reliable. I used to have scores of bash scripts doing everything for me but after learning Perl I disciplined myself to go to the extra effort of writing a Perl program in order to sharpen my skills. All those bash scripts that became Perl scripts are now Ruby scripts! Using OOP makes them a breeze to maintain and extend and they fail much less often. Les