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: > > 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 qui

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 keywo

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 problems

2001-10-21 Thread Daniel Beckham
aniel Beckham - Original 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

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

2001-10-21 Thread Daniel Beckham
re included into a main script of some sort, > >that basic function library is now being included twice. > > > >Daniel > > > >- Original Message - > >From: "Zeev Suraski" <[EMAIL PROTECTED]> > >To: "Brian Moon" <[EMAIL PROTECTED]> >

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

2001-10-21 Thread Brian Moon
t; <[EMAIL PROTECTED]> 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

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

2001-10-21 Thread Zeev Suraski
I think we can relax this thread now... Can we agree on this: 1. Stay with what we've been having until today, as in, revert the current patch. It should be a one liner. 2. Look into adding an implicit _once directive into PHP. I want some feedback on this, to see if it's really going to he

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 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 Zeev Suraski
rom: "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 so

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

2001-10-20 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

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

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

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

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

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 i

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 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>> r

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

2001-10-19 Thread Daniel Beckham
evelopment" <[EMAIL PROTECTED]> Sent: Friday, October 19, 2001 11:54 AM 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

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

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-Power

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

2001-10-19 Thread Rasmus Lerdorf
file ee: file ee1: 10:11am rasmus:~> php ee1 X-Powered-By: PHP/4.0.8-dev Content-type: text/html Fatal error: Cannot redeclare foo() (previously declared in /usr/local/home/rasmus/ee:5) in /usr/local/home/rasmus/ee on line 4 /usr/local/home/rasmus/ee(4) : Fatal error - Cannot redeclare foo(

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 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 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 dif

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
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 copy&paste of his code? Basically, unless the functions are in the top-level scope, there won't be any problems, bec

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 definit

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

2001-10-19 Thread Brian Moon
ED]> Sent: Friday, October 19, 2001 9:48 AM Subject: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate function problems > > 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

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_o

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

2001-10-19 Thread Brian Moon
[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 include_once() or if/endif ever

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

2001-10-19 Thread Daniel Beckham
t; <[EMAIL PROTECTED]> 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 mea

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
- 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

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

2001-10-19 Thread Daniel Beckham
<[EMAIL PROTECTED]> Cc: "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 f

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

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

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

2001-10-19 Thread Daniel Beckham
L PROTECTED]>; "PHP Development" <[EMAIL PROTECTED]> Sent: Friday, October 19, 2001 2:49 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>>

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

2001-10-19 Thread Edin Kadribasic
ECTED]>; "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

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

2001-10-19 Thread Brian Moon
t;; "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 >

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 > > = > > > include 'testlib.php'; > > include 'testlib.php'; > > test(); > > ?> > > testlib.php > > == > > > if (!defined('_TESTLIB_PHP')) { > > define ('_TESTLIB_PHP', 1); > >

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 > = > include 'testlib.php'; > include 'testlib.php'; > test(); > ?> > testlib.php > == > if (!defined('_TESTLIB_PHP')) { > define ('_TESTLIB_PHP', 1); > > function test() { > pri

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 = testlib.php == This however does not work and IMHO should not work. (It did work on PHP 4.0.6) testlib.php == The second example utilises the fact that the script compiling stoped at re

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
> 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

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

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 s

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

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 w

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 sol

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

2001-10-18 Thread Daniel Beckham
sday, 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. Cou

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 Brian Moon
n" <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Thursday, October 18, 2001 9:53 AM > Subject: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate > function problems > > > > On Thu, 18 Oct 2001, Brian Moon wrote:

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 t

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 t

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

2001-10-18 Thread Brian Moon
t; Cc: "PHP Development" <[EMAIL PROTECTED]> Sent: 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 s

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 Develo

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

2001-10-18 Thread Brian Moon
18, 2001 9:53 AM Subject: 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

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]

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 di