Re: I hope this is the last email about this :) (was RF
| From: | Yasuo Ohgaki | Date: | Fri, 25 Oct 2002 09:33:55 +0000 |
| Subject: | Re: I hope this is the last email about this :) (was RF | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-90098@lists.php.net to get a copy of this message | ||
Mike,
It seems my last mail is a bit too negative. Sorry.
Mike Ford wrote:
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.-----Original Message----- From: Yasuo Ohgaki [mailto:yohgaki@ohgaki.net] Sent: 24 October 2002 07:42 To: php-dev@lists.php.net; Alan Knowles Alan Knowles wrote:Add one more -- or even more, as I 'd say I'm +>1 for this!Im +1 for reverting the patch - (for what it's worth)This makes 2+ for having auto flushing :)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.
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.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.
I think only very little CLI programs, less than 1%, a few % at most, need auto flushing. -- Yasuo OhgakiLet'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%.