Re: [dwm] problem with dmenu3.1

From: Marek Bernat <marek.bernat_AT_gmail.com>
Date: Wed, 23 May 2007 23:22:15 +0200

On 5/23/07, Sander van Dijk <a.h.vandijk_AT_gmail.com> wrote:
>
>
> Have you seen any language that make calls to tr, sed, awk, cut, cat,
> etc.? Of course not. One could abuse the system() call of C to do
> that, but that would just be stupid.
> Then why do we continuously do this with the shell? Because the
> original purpose of the shell was to act as _programglue_. The basic
> idea behind the UNIX userland was to create a lot of small,
> specialized programs (somewhat like functions), all using a standard
> interface for communication (stdin/stdout), and then use a "top-level"
> program (the shell) to make them interact.
> The shell should do as much as it has to to perform that function, but
> no more than that. Things like test, echo, kill, printf, fall
> completely outside its scope. The shell's function is to tie programs
> together, not to be an all encompassing programming language. Trying
> to promote sh(1) to that is stupid, you could then just as well use
> java/python/ruby whatever you prefer.

Of course. You misunderstood me just like Anselm did.
I wasn't arguing against the glueing funcionality.
Instead I talked about that logic needed to be in the language.
Shell is something more than glue. If it was just a glue, you could use
pipe.
It is on the other hand quite normal interpreted language.
Therefore it makes sense to imlement logic testing in the core.
That's what I am talking about.

> On the other hand kill, echo and other programs like this should of course
> > be outside the shell.
>
> Yes, and test with that. The if/then/else mechanism belongs in the
> shell, the test itself (whether it is succes or failure of sleep, cat,
> cut, vi, or test doesn't matter) should _not_ be part of the shell.

I disagree. There is a line between purity and sanity.
Forking to see whether two variables equal _is_ stupid.
No other language does this. And shell _is_ a language.
It would make sense only if the forking had no overhead.
But it's quite the other way around.

> But I believe this is not about UNIX philosophy, but about designing a
> clean
> > and effective language (even a shell) and keeping everything that is not
> a
> > part of the language itself in external libraries/programs.
>
> Indeed, and like I said, the test itself belongs outside the shell.
> "test" doesn't even come close to covering the things you could
> possibly want to test anyway.

Of course it doesn't comprise everything.
But I do believe logic and arithmetic tests cover 99% of the conditions in
the if statement.
That's the reasoning behind this.

Regards, Marek
Received on Wed May 23 2007 - 23:22:18 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 14:42:39 UTC