This is exactly what I was saying and a magic "include_once" token in the file is a great idea. I was never making a case for leaving buggy code in PHP, only that if you were going to change the behavior, you would also add more flexible ways to do the job.
Daniel ----- Original Message ----- From: "Rasmus Lerdorf" <[EMAIL PROTECTED]> To: "Stanislav Malyshev" <[EMAIL PROTECTED]> Cc: "Daniel Beckham" <[EMAIL PROTECTED]>; "Brian Moon" <[EMAIL PROTECTED]>; "PHP Development" <[EMAIL PROTECTED]> Sent: Friday, October 19, 2001 3:15 AM Subject: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems > Stanislav, he does have a point in that it would be a good idea to be able > to create an include file which protected itself from multiple exclusion > instead of relying on the user to use the file correctly. That's what he > means by bad style. There could be cases where you created a system where > some files were designed to be included multiple times and others were > designed not to. Putting the responsibility on the user to figure out > which is which is not great. It would be nice if you could trigger the > include_once functionality from the file being included. > > Almost like the call-time-pass-by-reference vs. > force-reference-in-func-declaration argument. Not quite the same, but I > think you see what I mean. > > Since you can no longer do: > > if(!defined(_FOO_INC)): > define('_FOO_INC',1); > > ... > > endif; > > to protect a file from multiple inclusion within the file itself, some > other mechanism would be nice. I wouldn't say this was crucial, but I > definitely see the case for it. Some sort of magical 'only_once' token at > the top of an included file which forces the include to act like an > include_once for that file might do it, or as Brian did, don't toss fatal > errors if the same function is redefined in the same file. > > -Rasmus > > > On Fri, 19 Oct 2001, Stanislav Malyshev wrote: > > > DB>> Essentially, to answer your question. include_once() is a very > > DB>> poor way to write modular code that will be used across > > DB>> different projects and across different developers. You are > > > > Why? > > > > DB>> placing the responsibility of not accidentally redefining > > DB>> function names on the user of the function library or code file > > DB>> and not on the file itself as it should be and as it is in other > > DB>> languages such as C. To put it shortly, it's a backwards way of > > > > PHP is not C. So PHP can not be "such as C". You are placing > > responcibility of including a module onto the engine, and that is > > completely OK with me. I agree that it would be good to have more > > developed concept of a package and all the hoopla that is going with that > > - but until then, I see nothing wrong in include_once. > > > > DB>> including files and it's a poor programming technique. > > > > Why? > > > > > > > -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]