On Mon, 28 Jun 2010 18:57:45 +0100, John Nagle <na...@animats.com> wrote:

On 6/28/2010 7:58 AM, Benjamin Kaplan wrote:
How does a program return anything other than an exit code?

    Ah, yes, the second biggest design mistake in UNIX.

    Programs have "argv" and "argc", plus environment variables,
going in.  So, going in, there are essentially subroutine parameters.
But all that comes back is an exit code. They should have had
something similar coming back, with arguments to "exit()" returning
the results.  Then the "many small intercommunicating programs"
concept would have worked much better.

That's not just a little harsh, given that I've never known any operating system that returned more than an integer exit code, it's blithely ignoring the Unix paradigm. It's stream-based processing; argv and the environment are better thought of as switches, controlling how a program treats stdin to produce stdout. Classic Unix programming is a matter of stringing a bunch of tools together with pipes to get the output you want. This isn't a great paradigm for GUIs (not without tweaking that hasn't really been done), but then again it was never meant to be.

    C was like that once.  In the 1970s, all you could return was
an "int" or a "float".  But that got fixed.

Strangely, these facts are not unconnected.

--
Rhodri James *-* Wildebeeste Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to