Mike,

It seems my last mail is a bit too negative. Sorry.

Mike Ford wrote:
-----Original Message-----
From: Yasuo Ohgaki [mailto:yohgaki@;ohgaki.net]
Sent: 24 October 2002 07:42
To: [EMAIL PROTECTED]; Alan Knowles

Alan Knowles wrote:

Im +1 for reverting the patch - (for what it's worth)

This makes 2+ for having auto flushing :)

Add one more -- or even more, as I 'd say I'm +>1 for this!


BTW, real language (i.e. not shell) don't flush. Please let me
know if there is real language that do automatic flushing by
default.

But PHP-CLI *is* a shell-scripting language, and therefore should behave
like one.  Other flavours of PHP aren't, and shouldn't.  QED.
I'm referring to actual shell used for user interface, such as
bash, csh.

AFAIK, all shells flushes automatically, but no programing language
that is designed for programming do not flush.


In addition, is it too difficult to write this kind of code?

function prompt($prefix) {
 echo $prefix;
 flush();
}

I think this kind of code will be taught at the first
class of programming course. (I could be wrong,
since I don't know where people learned programming ;)

At university: learned half-a-dozen languages; *all* of them flushed streams
open on TTY either after every character, or (at line-end or when input
requested from same device).  I've been programming now for over 25 years,
and this is *still* the behaviour I expect by default when programming
command-line-executable scripts or programs.
If people would like to a script that can be used as filter,
auto flushing is evil.

If people writing interactive CUI programs,

function prompt($prefix) {
  echo $prefix;
  flush();
}

is enough.

Line buffering is enough for all most all purposes.
Don't forget auto flushing make system call flush stream twice
with following script always.

echo "abc\n";

And flushing is relatively heavy thing to do.


Let's guess something interesting.

How much % of scripts actually needs automatic flushing?
My guess is less than 1%. What is yours?

For PHP-CLI: more than 90%.
For PHP CGI or SAPI: much less than 1%.
I think only very little CLI programs, less than 1%, a few %
at most, need auto flushing.

--
Yasuo Ohgaki


--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to