Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-27 Thread Stig S. Bakken
Stanislav Malyshev wrote: DB I do not know Java. In Perl, namespaces exist, so it's a DB completely different ballgame. But even still, it's not the DB responsibility of the user to know the inner workings of a DB module or package in Perl. If we talking about how to quick hack PHP

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-26 Thread Stig S. Bakken
Stanislav Malyshev wrote: SSB Basically, I think we should postpone fixing all of this for the SSB ZE2-version of PHP, so we can do it proper. I think this could be done without waiting for ZE2. ZE1 has everything that is needed for this, if only you do not insist on having keyword for

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-21 Thread Stig S. Bakken
Daniel Beckham wrote: - Original Message - From: Stanislav Malyshev [EMAIL PROTECTED] To: Daniel Beckham [EMAIL PROTECTED] Cc: php-dev [EMAIL PROTECTED] Sent: Saturday, October 20, 2001 4:58 PM Subject: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-21 Thread Stanislav Malyshev
SSB Basically, I think we should postpone fixing all of this for the SSB ZE2-version of PHP, so we can do it proper. I think this could be done without waiting for ZE2. ZE1 has everything that is needed for this, if only you do not insist on having keyword for it but it is OK with you to use

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-21 Thread Stanislav Malyshev
DB I do not know Java. In Perl, namespaces exist, so it's a DB completely different ballgame. But even still, it's not the DB responsibility of the user to know the inner workings of a DB module or package in Perl. If we talking about how to quick hack PHP engine so that it would suit

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-21 Thread Brian Moon
] To: Daniel Beckham [EMAIL PROTECTED] Cc: Brian Moon [EMAIL PROTECTED]; Edin Kadribasic [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Sunday, October 21, 2001 3:34 AM Subject: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems Yeah, ok, but that's what I'm getting

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-21 Thread Daniel Beckham
[EMAIL PROTECTED] To: Brian Moon [EMAIL PROTECTED] Cc: Edin Kadribasic [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Saturday, October 20, 2001 8:42 PM Subject: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems At 19:11 19-10-01, Brian Moon wrote: - Even

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-21 Thread Daniel Beckham
Message - From: Stanislav Malyshev [EMAIL PROTECTED] To: Daniel Beckham [EMAIL PROTECTED] Cc: php-dev [EMAIL PROTECTED] Sent: Sunday, October 21, 2001 5:12 AM Subject: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems DB I do not know Java. In Perl, namespaces

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-21 Thread Daniel Beckham
- Original Message - From: Zeev Suraski [EMAIL PROTECTED] To: Stanislav Malyshev [EMAIL PROTECTED] Cc: Daniel Beckham [EMAIL PROTECTED]; php-dev [EMAIL PROTECTED] Sent: Sunday, October 21, 2001 5:21 AM Subject: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-20 Thread Stanislav Malyshev
DB My argument is that some functionality similar to a C #ifdef and DB #ifndef is needed. Neither the include_once() nor the if/endif Tell me how, for example, Java or Perl programmers manage to live without ifdefs. DB I already pointed out why include_once() is bad. You place the DB

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-20 Thread Stanislav Malyshev
BM An E_NOTICE is raised at runtime. I know many people ignore BM these, but it is there. That's like saying I know nobody will hear the fire alarm, because I have switched it off, but I'll still press the alarm button and consider it to be the proper way to report the fire. -- Stanislav

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-20 Thread Zeev Suraski
At 23:58 20-10-01, Stanislav Malyshev wrote: DB My argument is that some functionality similar to a C #ifdef and DB #ifndef is needed. Neither the include_once() nor the if/endif Tell me how, for example, Java or Perl programmers manage to live without ifdefs. At least as far as Java is

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-20 Thread Zeev Suraski
At 19:11 19-10-01, Brian Moon wrote: - Even with no protection at all, function redefinitions will not be reported. That's kind of ugly. An E_NOTICE is raised at runtime. I know many people ignore these, but it is there. So basically, your existing code base will now be issuing tons of

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-20 Thread Daniel Beckham
- Original Message - From: Zeev Suraski [EMAIL PROTECTED] To: Brian Moon [EMAIL PROTECTED] Cc: Edin Kadribasic [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Saturday, October 20, 2001 8:42 PM Subject: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems At 19:11 19-10-01

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-19 Thread Stanislav Malyshev
DB where people were attempting to actually redefine a function DB name. Brian's patch allows the compiler to encounter the same DB function in the same file on the same line and only give a DB notice instead of a fatal error. It's not the most elegant Which is not backward-compatible with how

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-19 Thread Stanislav Malyshev
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

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-19 Thread Rasmus Lerdorf
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

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-19 Thread Stanislav Malyshev
RL Stanislav, he does have a point in that it would be a good idea to be able RL to create an include file which protected itself from multiple exclusion RL instead of relying on the user to use the file correctly. That's what he I'm these minutes finish to write a proposal which is meant to

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-19 Thread Edin Kadribasic
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 This is still a valid construct. I could find nothing in the discussion that would indicate otherwise. The only thing that

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-19 Thread Rasmus Lerdorf
It is valid in the sense that the code would not be executed the second time, but it isn't valid for preventing multiple function definitions inside that block. ie. no conditional function definitions. -Rasmus On Fri, 19 Oct 2001, Edin Kadribasic wrote: Since you can no longer do:

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-19 Thread Edin Kadribasic
I guess I do not understand. The following example works just fine in PHP 4.1.0RC1: test.php = ?php include 'testlib.php'; include 'testlib.php'; test(); ? testlib.php == ?php if (!defined('_TESTLIB_PHP')) { define ('_TESTLIB_PHP', 1); function test() { print Function test()\n;

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-19 Thread Rasmus Lerdorf
I guess I do not understand. The following example works just fine in PHP 4.1.0RC1: test.php = ?php include 'testlib.php'; include 'testlib.php'; test(); ? testlib.php == ?php if (!defined('_TESTLIB_PHP')) { define ('_TESTLIB_PHP', 1); function test() { print

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-19 Thread Edin Kadribasic
I guess I do not understand. The following example works just fine in PHP 4.1.0RC1: test.php = ?php include 'testlib.php'; include 'testlib.php'; test(); ? testlib.php == ?php if (!defined('_TESTLIB_PHP')) { define ('_TESTLIB_PHP', 1); function test()

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-19 Thread Brian Moon
PROTECTED]; PHP Development [EMAIL PROTECTED] Sent: Friday, October 19, 2001 5:22 AM Subject: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems I guess I do not understand. The following example works just fine in PHP 4.1.0RC1: test.php = ?php include 'testlib.php

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-19 Thread Edin Kadribasic
[EMAIL PROTECTED]; Daniel Beckham [EMAIL PROTECTED]; Brian Moon [EMAIL PROTECTED]; PHP Development [EMAIL PROTECTED] Sent: Friday, October 19, 2001 5:22 AM Subject: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems I guess I do not understand. The following example

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-19 Thread Daniel Beckham
AM Subject: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems 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

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-19 Thread Daniel Beckham
- 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

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-19 Thread Daniel Beckham
[EMAIL PROTECTED]; Brian Moon [EMAIL PROTECTED]; PHP Development [EMAIL PROTECTED] Sent: Friday, October 19, 2001 3:43 AM Subject: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems RL which is which is not great. It would be nice if you could trigger the RL

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-19 Thread Daniel Beckham
- Original Message - From: Stanislav Malyshev [EMAIL PROTECTED] To: Daniel Beckham [EMAIL PROTECTED] Cc: Brian Moon [EMAIL PROTECTED]; PHP Development [EMAIL PROTECTED] Sent: Friday, October 19, 2001 2:45 AM Subject: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-19 Thread Edin Kadribasic
By all means, if you have a decent proposal that doesn't involve exclusively using include_once() or if/endif everywhere possible, we would love to hear it. I'm just curious: what's wrong with using if/endif where include_once isn't good enough? -- PHP Development Mailing List

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-19 Thread Daniel Beckham
] To: Daniel Beckham [EMAIL PROTECTED] Cc: PHP Development [EMAIL PROTECTED] Sent: Friday, October 19, 2001 9:27 AM Subject: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems By all means, if you have a decent proposal that doesn't involve exclusively using

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-19 Thread Brian Moon
] New zend_compile.c to solve all of the duplicate function problems By all means, if you have a decent proposal that doesn't involve exclusively using include_once() or if/endif everywhere possible, we would love to hear it. I'm just curious: what's wrong with using if/endif where

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-19 Thread Edin Kadribasic
The problem is backward compatiblity. That is the biggest thing at stake here. Daniel and I are a bit skewed as we have over 1000 files full of code that start with something like: if(defined(_FILE_NAME)) return; define(_FILE_NAME, 1); This was our solution _before_ include_once ever

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-19 Thread Zeev Suraski
Nope, Edin was right. It's valid in both senses. Zeev At 11:50 19-10-01, Rasmus Lerdorf wrote: It is valid in the sense that the code would not be executed the second time, but it isn't valid for preventing multiple function definitions inside that block. ie. no conditional function

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-19 Thread Zeev Suraski
Clearly, you shouldn't be getting function redefinitions with the way you wrote the code. I'm not sure why Rasmus is getting them, Rasmus - are you sure you're running an exact copypaste of his code? Basically, unless the functions are in the top-level scope, there won't be any problems,

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-19 Thread Zeev Suraski
At 16:33 19-10-01, Daniel Beckham wrote: The reason it works inside of an if/endif is because the code is never pre-compiled and only executed during run time. For large code libraries, like we have here at our office, this would cause a performance decrease. The code is precompiled alright.

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-19 Thread Zeev Suraski
At 17:47 19-10-01, Brian Moon wrote: It is in fact slightly faster. I created a script with 10 functions like: function foo1() { echo 1; } It was 3.3 seconds to 3.6 seconds in favor of the patched code. That's like comparing apples and palm trees though, because the behavior was

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-19 Thread Brian Moon
- Even with no protection at all, function redefinitions will not be reported. That's kind of ugly. An E_NOTICE is raised at runtime. I know many people ignore these, but it is there. Brian. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED]

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-19 Thread Rasmus Lerdorf
file ee: ? if(!defined(_FOO_INC)): define('_FOO_INC',1); function foo() { echo Hello World\n; } endif; ? file ee1: ? include 'ee'; include 'ee'; foo(); ? 10:11am rasmus:~ php ee1 X-Powered-By: PHP/4.0.8-dev Content-type: text/html br /

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-19 Thread Edin Kadribasic
If I put quotes around the string it works: if(!defined('_FOO_INC')): file ee: ? if(!defined(_FOO_INC)): define('_FOO_INC',1); function foo() { echo Hello World\n; } endif; ? file ee1: ? include 'ee'; include 'ee'; foo(); ? 10:11am rasmus:~ php ee1 X-Powered-By:

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-19 Thread Rasmus Lerdorf
ah, duh.. Right. On Fri, 19 Oct 2001, Edin Kadribasic wrote: If I put quotes around the string it works: if(!defined('_FOO_INC')): file ee: ? if(!defined(_FOO_INC)): define('_FOO_INC',1); function foo() { echo Hello World\n; } endif; ? file ee1: ? include 'ee';

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-19 Thread Daniel Beckham
Subject: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems At 16:33 19-10-01, Daniel Beckham wrote: The reason it works inside of an if/endif is because the code is never pre-compiled and only executed during run time. For large code libraries, like we have

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-18 Thread Andrei Zmievski
On Thu, 18 Oct 2001, Brian Moon wrote: Ok, I played with the code in zend_compile.c last night and came up with this solution. The attached file will only issue a NOTICE for duplicate functions from the same line and file. It will still issue an ERROR for duplicate functions of a

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-18 Thread Brian Moon
See bug 13616. Brian. - Original Message - From: Stanislav Malyshev [EMAIL PROTECTED] To: Brian Moon [EMAIL PROTECTED] Cc: PHP Development [EMAIL PROTECTED] Sent: Thursday, October 18, 2001 10:01 AM Subject: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-18 Thread Brian Moon
to solve all of the duplicate function problems On Thu, 18 Oct 2001, Brian Moon wrote: Ok, I played with the code in zend_compile.c last night and came up with this solution. The attached file will only issue a NOTICE for duplicate functions from the same line and file. It will still issue

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-18 Thread Stanislav Malyshev
BM See bug 13616. I see. I think you should really use include_once - I just do not see the reason why not to do it and why patch the code instead. Could you explain? -- Stanislav Malyshev, Zend Products Engineer [EMAIL PROTECTED] http://www.zend.com/ +972-3-6139665 ext.115 -- PHP

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-18 Thread Brian Moon
: Thursday, October 18, 2001 10:14 AM Subject: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems BM See bug 13616. I see. I think you should really use include_once - I just do not see the reason why not to do it and why patch the code instead. Could you explain

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-18 Thread Stanislav Malyshev
BM include_once as i have already stated is useless inside of a BM function. Variables in the file are not global. And, I cannot Why include_once inside a function is different from include inside a function? BM include it again with include_once. The example I gave is not BM acurate to how

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-18 Thread Brian Moon
BM include_once as i have already stated is useless inside of a BM function. Variables in the file are not global. And, I cannot Why include_once inside a function is different from include inside a function? Because once include_once is used on a file, include_once won't include the file

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-18 Thread Brian Moon
: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems On Thu, 18 Oct 2001, Brian Moon wrote: Ok, I played with the code in zend_compile.c last night and came up with this solution. The attached file will only issue a NOTICE for duplicate functions

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-18 Thread Stanislav Malyshev
BM It is not a matter of the functions. If everything were a function or class BM ( like Java ) this would not be an issue. But, we have variables and such BM in these files that prevent us from be able to trust include_once. Ah. Now I see what you mean. Then the solution would be or use

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-18 Thread Daniel Beckham
to solve all of the duplicate function problems BM See bug 13616. I see. I think you should really use include_once - I just do not see the reason why not to do it and why patch the code instead. Could you explain? -- Stanislav Malyshev, Zend Products Engineer [EMAIL PROTECTED] http

Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems

2001-10-18 Thread Daniel Beckham
- Original Message - From: Stanislav Malyshev [EMAIL PROTECTED] To: Brian Moon [EMAIL PROTECTED] Cc: PHP Development [EMAIL PROTECTED] Sent: Thursday, October 18, 2001 10:53 AM Subject: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems BM And my fix