9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Russ Cox" <rsc@plan9.bell-labs.com>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] weird print(2) problems...
Date: Wed,  5 Sep 2001 15:19:40 -0400	[thread overview]
Message-ID: <20010905191944.AC31319A04@mail.cse.psu.edu> (raw)

> print() shouldn't call write(), as there's nothing to write.

then {echo ''} shouldn't print a newline, as there's nothing to echo.
there's no obvious answer except that we shouldn't try to "fix" it.

see _The Unix Programming Environment_,
Kernighan & Pike (1984), pp. 77-79, "A digression on echo".

the below won't make sense if you don't read k&p first,
and even then it might not make sense.  it's not quite
as amusing as i thought at the time, but the first week of
march 1999 is missing from the web archives, so i feel obligated
to repost it.

russ


 From cse.psu.edu!owner-9fans Fri Mar  5 14:18:21 EST 1999
Date: Fri, 5 Mar 1999 14:09:19 -0500
To: 9fans@cse.psu.edu
From: "Russ Cox" <rsc@plan9.bell-labs.com>
Subject: re: [9fans] What happens when you do an echo -n?
Sender: owner-9fans@cse.psu.edu
Reply-To: 9fans@cse.psu.edu

                     The Plan 9 and the Echo
           (With my deepest apologies to Doug McIlroy)

    There dwelt in the land of New Jersey, the Unix, a fair maid whom
savants traveled far to admire.  Her story has already been told.

    As the Unix grew older, younger maidens began to imitate her ways,
sometimes even to the point of changing their names to sound like
her's, in attempts to attract suitors, especially the insufferably rich
ones.  As more maidens began to act like the Unix, all but the most
exacting of suitors left the Unix for these pale stereotypes.

    When the Unix had grown old, and her myriad suitors had left her
for younger maids whose imitation of the Unix was ``good enough'', the
Unix took under her wing the Plan 9, but a small child at the time.
The Unix endeavored to teach the lessons she had learned over her
lifetime, that the Plan 9 need not make the Unix's mistakes herself.
Under the Unix's tutelage, the Plan 9 grew to be a beautiful young
maid herself.  She had far fewer suitors than the Unix had once
enjoyed, since she was competing with the Unix imitators.  Even so, a
small but faithful group of savants admired her, dazzled by the grace
and civility the Unix had taught her.  Still others were amazed by her
agility in performing exacting tasks seldom accomplished even by the
Unix.

    One sad day, the Unix passed away, leaving the Plan 9, fully grown
at this point, to fend for herself.  In deference to the venerable
Unix, Nature herself now answered to the Plan 9 more eagerly than to
other mortal beings.  Once again humbler folk delighted in such a pure
echo coming from the wilderness that had so frustrated their own
attempts since the Unix's younger days.  Taught well by her mother,
the Plan 9 obliged with perfect echoes of whatever she was asked.

    Some years later, a sensitive young lad asked the Plan 9, `Echo
nothing at all.'  Wise of the Unix's earlier troubles, the Plan 9
grinned slightly, kept her mouth closed, and did nothing.

    `Whatever do you mean,' the youth demanded, `not looking toward
the wilderness?  For perfect echoes cannot come back unless you are
facing the wilderness.  Henceforth turn toward the wilderness, even
when you are echoing nothing at all.'  And the Plan 9 obliged.

    `But echoing nothing at all is not a proper echo,' pleaded an
impatient swain, `so do not turn toward the wilderness when echoing
nothing at all.'  At this point the Plan 9 realized history repeating
itself, and although she did not want to offend either, she decided it
was better to offend the impatient youth rather than subject all her
suitors to yet another surfeit of notation.



             reply	other threads:[~2001-09-05 19:19 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-05 19:19 Russ Cox [this message]
2001-09-05 19:40 ` Boyd Roberts
2001-09-06  8:19 ` Matthew Hannigan
2001-09-06 16:18 ` Douglas A. Gwyn
2001-09-06 20:45   ` Boyd Roberts
  -- strict thread matches above, loose matches on Subject: below --
2001-09-11 11:16 rob pike
     [not found] <rsc@plan9.bell-labs.com>
2001-09-05 21:11 ` Russ Cox
2001-09-05 21:24   ` Scott Schwartz
2001-09-05 19:46 Russ Cox
2001-09-05 18:40 Russ Cox
2001-09-05 19:58 ` Dan Cross
2001-09-05 15:11 forsyth
2001-09-05 18:23 ` Dan Cross
2001-09-05 19:10   ` Boyd Roberts
     [not found] <cross@math.psu.edu>
2001-09-04 19:02 ` Dan Cross
2001-09-04 19:08   ` Scott Schwartz
2001-09-05 14:22     ` Dan Cross
2001-09-05 19:01       ` Boyd Roberts

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010905191944.AC31319A04@mail.cse.psu.edu \
    --to=rsc@plan9.bell-labs.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).