Re: [PHP-DEV] GOTO operator

2004-08-19 Thread Andrey Hristov
Is it good idea (and is it possible) to disallow GOTO in main() ? Andrey Quoting Robert Cummings [EMAIL PROTECTED]: On Wed, 2004-08-18 at 21:34, BDKR wrote: Hartmut Holzgraefe wrote: Sebastian Bergmann wrote: Exceptions are not an OOP feature per-se. They are a means for out-of-

Re: [PHP-DEV] GOTO operator

2004-08-19 Thread Hartmut Holzgraefe
Alan Knowles wrote: - compile time hooking (no dynamic goto targets) That kind of makes them useless for writing parsers, which was one of the justifications of them. How that? C doesn't have dynamic goto targets either but still its used for parsing lot ... -- Hartmut Holzgraefe [EMAIL

Re: [PHP-DEV] GOTO operator

2004-08-19 Thread Zeev Suraski
At 04:28 19/08/2004, Hartmut Holzgraefe wrote: Sebastian Bergmann wrote: Exceptions are not an OOP feature per-se. They are a means for out-of- band error signalling. (Of course they use objects for that which could be regarded as a turn-off by non-OOP-eople :-) they can also be a turn-off for

Re: [PHP-DEV] GOTO operator

2004-08-19 Thread Alan Knowles
if you look at the bison/flex, they both use switch/case - the parsers I use, both generate code like this, however they ended up using variable functions, as even the overhead of the function calls is faster than the large switch/case called repeatidly.. (this is ideally what dynamic goto's

Re: [PHP-DEV] GOTO operator

2004-08-19 Thread Rasmus Lerdorf
On Thu, 19 Aug 2004, Hartmut Holzgraefe wrote: Alan Knowles wrote: - compile time hooking (no dynamic goto targets) That kind of makes them useless for writing parsers, which was one of the justifications of them. How that? C doesn't have dynamic goto targets either but still

Re: [PHP-DEV] GOTO operator

2004-08-19 Thread Hartmut Holzgraefe
Rasmus Lerdorf wrote: Alan Knowles wrote: How that? C doesn't have dynamic goto targets either but still its used for parsing lot ... That depends on what you consider C. Try compiling this with your favourite C compiler: Every day you lern something new ... looks like i'm already done with that

Re: [PHP-DEV] GOTO operator

2004-08-19 Thread Zeev Suraski
At 12:21 19/08/2004, Sascha Schumann wrote: On Thu, 19 Aug 2004, Rasmus Lerdorf wrote: On Thu, 19 Aug 2004, Hartmut Holzgraefe wrote: Alan Knowles wrote: - compile time hooking (no dynamic goto targets) That kind of makes them useless for writing parsers, which was one of the justifications of

Re: [PHP-DEV] GOTO operator

2004-08-18 Thread Sebastian Bergmann
Derick Rethans wrote: heh? If you're writing procedural code, you do not WANT to use OO features in there, as it makes your code no longer procedural. Exceptions are not an OOP feature per-se. They are a means for out-of- band error signalling. (Of course they use objects for that which could

Re: [PHP-DEV] GOTO operator

2004-08-18 Thread Marcus Boerger
Hello Sebastian, Wednesday, August 18, 2004, 11:58:33 PM, you wrote: Derick Rethans wrote: heh? If you're writing procedural code, you do not WANT to use OO features in there, as it makes your code no longer procedural. Exceptions are not an OOP feature per-se. They are a means for

Re: [PHP-DEV] GOTO operator

2004-08-18 Thread BDKR
Hartmut Holzgraefe wrote: Sebastian Bergmann wrote: Exceptions are not an OOP feature per-se. They are a means for out-of- band error signalling. (Of course they use objects for that which could be regarded as a turn-off by non-OOP-eople :-) they can also be a turn-off for performance anxious

Re: [PHP-DEV] GOTO operator

2004-08-18 Thread Robert Cummings
On Wed, 2004-08-18 at 21:34, BDKR wrote: Hartmut Holzgraefe wrote: Sebastian Bergmann wrote: Exceptions are not an OOP feature per-se. They are a means for out-of- band error signalling. (Of course they use objects for that which could be regarded as a turn-off by non-OOP-eople :-)

Re: [PHP-DEV] GOTO operator

2004-08-18 Thread Sebastian Bergmann
Marcus Boerger wrote: Not exactly. In most languages exceptions are objects but in other languages like C++ you can pass whatever you want as amn exception. I made the mistake of mixing the general case (out-of-band error signalling) and the special case (Exception objects in PHP). -- Sebastian

Re: [PHP-DEV] GOTO operator

2004-08-18 Thread Alan Knowles
- compile time hooking (no dynamic goto targets) That kind of makes them useless for writing parsers, which was one of the justifications of them. Regards Alan - goto can only jump to labels within the same scope - goto could only jump out of blocks and not into Cheers, Rob. --

Re: [PHP-DEV] GOTO operator

2004-08-18 Thread Robert Cummings
On Thu, 2004-08-19 at 00:10, Alan Knowles wrote: - compile time hooking (no dynamic goto targets) That kind of makes them useless for writing parsers, which was one of the justifications of them. Hmmm you're right. I forgot that in C when doing parsers it's commonplace to map the

Re: [PHP-DEV] GOTO operator

2004-08-06 Thread Brian Kell
If anyone in this debate hasn't read my independent request for goto and break label;, I would appreciate it if you would: http://bugs.php.net/bug.php?id=29287 I fully support the implementation of goto. Line labels will also immensely improve the break statement, which currently requires you

Re: [PHP-DEV] GOTO operator

2004-08-04 Thread tinys xuefer
the question here? it is said: Internals list A medium volume list for those who want to __help out__ with the development of PHP From: tinys xuefer [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: [PHP-DEV] GOTO operator Date: Sat, 31 Jul 2004 15:16:54 +0800 MIME-Version: 1.0 X-Originating-IP

Re: [PHP-DEV] GOTO operator

2004-08-04 Thread Marcus Boerger
Hello tinys, that's the perfect place to mail such things regards marcus Wednesday, August 4, 2004, 12:07:46 PM, you wrote: i'm current trying: MAKE_STD_ZVAL(return_value); *return_value = **zstr; /*ZVAL_ADDREF(*zstr);*/ if (PZVAL_IS_REF(return_value)) {

Re: [PHP-DEV] GOTO operator

2004-08-04 Thread Derick Rethans
On Wed, 4 Aug 2004, Marcus Boerger wrote: Hello tinys, that's the perfect place to mail such things But make sure to use a good subject... (and don't piggy back on other threads with a new topic) please Derick -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit:

Re: [PHP-DEV] GOTO operator

2004-08-04 Thread tinys xuefer
thanks it's my mistake, i didn't want to reply this thread but reply to my own one From: Derick Rethans [EMAIL PROTECTED] To: Marcus Boerger [EMAIL PROTECTED] CC: tinys xuefer [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: Re: [PHP-DEV] GOTO operator Date: Wed, 4 Aug 2004 12:51:56 +0200 (CEST) MIME

Re: [PHP-DEV] GOTO operator

2004-08-03 Thread Andrey Hristov
Quoting DvDmanDT [EMAIL PROTECTED]: And my point still remains. There are an awful lot of PHP programmers out there who really don't need an extra way to write for(), or while(), or do..while(). It makes maintenance work harder when you have a mixture of styles in there to cope with.

Re: [PHP-DEV] GOTO operator

2004-08-03 Thread Derrell . Lipman
Andi Gutmans [EMAIL PROTECTED] writes: I don't think we should be using computed targets. It'd be more of a nightmare than sexy. I prefer doing as much at compile-time as possible and I don't think that allowing indirect goto's would lead to anything than chaos. Most arguments in favor of

Re: [PHP-DEV] GOTO operator

2004-08-03 Thread Derick Rethans
On Tue, 3 Aug 2004 [EMAIL PROTECTED] wrote: Andi Gutmans [EMAIL PROTECTED] writes: I don't think we should be using computed targets. It'd be more of a nightmare than sexy. I prefer doing as much at compile-time as possible and I don't think that allowing indirect goto's would lead to

Re: [PHP-DEV] GOTO operator

2004-08-03 Thread Sara Golemon
If you really, really, really wanted to do such a thing, you could still do: eval(goto foo$bar;); to get the same effect, right? Hmm, depends on how it's implemented. It will most likely not work I guess. Nope... eval()'d code is in a separate op_array from the code it's eval()'d

Re: [PHP-DEV] GOTO operator

2004-08-03 Thread Sterling Hughes
It can't be doable because it makes writing an optimizer impossible. -sterling On Tue, 3 Aug 2004 11:54:28 -0700, Sara Golemon [EMAIL PROTECTED] wrote: If you really, really, really wanted to do such a thing, you could still do: eval(goto foo$bar;); to get the same effect,

Re: [PHP-DEV] GOTO operator

2004-08-03 Thread Derrell . Lipman
Sara Golemon [EMAIL PROTECTED] writes: If you really, really, really wanted to do such a thing, you could still do: eval(goto foo$bar;); to get the same effect, right? Hmm, depends on how it's implemented. It will most likely not work I guess. Nope... eval()'d code is in a

Re: [PHP-DEV] GOTO operator

2004-08-03 Thread Sara Golemon
Out of curiosity, I wonder which other features would similarly not work when eval()'ed...??? Anything involving unbalanced braces would bork: eval('if ($a 5) {'); do_stuff(); } As would any looping initializer like this: eval('foreach($foo as $bar)'); do_itteration($bar); While I

Re: [PHP-DEV] GOTO operator

2004-08-03 Thread George Schlossnagle
On Aug 3, 2004, at 3:09 PM, [EMAIL PROTECTED] wrote: Sara Golemon [EMAIL PROTECTED] writes: If you really, really, really wanted to do such a thing, you could still do: eval(goto foo$bar;); to get the same effect, right? Hmm, depends on how it's implemented. It will most likely not work I

Re: [PHP-DEV] GOTO operator

2004-08-03 Thread Jason Garber
Hello, ALthough I'm in support of a local scoped static GOTO, I did not see myself using it much. However, I find myself this afternoon implementing a huge do { switch { case: break 2; } while (true) structure. It would be much cleaner to use goto in this case. -- Best regards,

Re: [PHP-DEV] GOTO operator

2004-08-03 Thread Jochem Maas
I'm +1 on goto with static labels. regardless of whether it ends up in PHP or not I think Sara deserves a gold star alone for the large number of very value info/explainations she continues to post here. If I had to name one person off the list from whose posts I had gained more insight

RE: [PHP-DEV] GOTO operator

2004-08-03 Thread Steph
Jochem: +1 :) -Original Message- From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: 04 August 2004 01:22 To: Sara Golemon Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DEV] GOTO operator I'm +1 on goto with static labels. regardless of whether it ends up in PHP or not I think Sara

Re: [PHP-DEV] GOTO operator

2004-08-02 Thread Derick Rethans
On Sun, 1 Aug 2004, Zeev Suraski wrote: At 15:45 31/07/2004, Derick Rethans wrote: Exceptions are an OO thing, and it makes NO sense to use them in procedural code. Goto is a good thing here. Can you explain why it makes no sense to use them in procedural code? heh? If you're writing

Re: [PHP-DEV] GOTO operator

2004-08-02 Thread Zeev Suraski
At 11:22 02/08/2004, Derick Rethans wrote: On Sun, 1 Aug 2004, Zeev Suraski wrote: At 15:45 31/07/2004, Derick Rethans wrote: Exceptions are an OO thing, and it makes NO sense to use them in procedural code. Goto is a good thing here. Can you explain why it makes no sense to use them in

Re: [PHP-DEV] GOTO operator

2004-08-02 Thread DvDmanDT
I just woke up but I think this can be solved with one do..while and using bitfield for example. so when you break, just check the bitfield what to clean up. Indeed, but the original point was to make it easier to read.. Now, what will make most sense to a newbie, this or the goto example this

RE: [PHP-DEV] GOTO operator

2004-08-02 Thread Steph
My opinion would be that goto isn't needed with the do..while() statement.. But on the other hand.. Neither for(), while() or do..while() would be needed with goto, would they? I learned a language called PHP. It contains for(), while() and do..while(). I've been writing scripts that

Re: [PHP-DEV] GOTO operator

2004-08-02 Thread DvDmanDT
My point still remains.. Goto is powerful, even if not needed.. There's about one time I would use goto, which could easily be done with two do..while().. The funny thing is, that I didn't do it that way, cause I though it looked ugly. -- // DvDmanDT MSN: dvdmandt¤hotmail.com Mail:

RE: [PHP-DEV] GOTO operator

2004-08-02 Thread Steph
My point still remains.. Goto is powerful, even if not needed.. There's about one time I would use goto, which could easily be done with two do..while().. The funny thing is, that I didn't do it that way, cause I though it looked ugly. And my point still remains. There are an awful lot of

Re: [PHP-DEV] GOTO operator

2004-08-02 Thread DvDmanDT
And my point still remains. There are an awful lot of PHP programmers out there who really don't need an extra way to write for(), or while(), or do..while(). It makes maintenance work harder when you have a mixture of styles in there to cope with. I don't for a moment believe that Sara

RE: [PHP-DEV] GOTO operator

2004-08-02 Thread Steph
My point was to say it's powerful, as powerful as all those, not that it could replace them.. I would still use while(), do..while() and for() the times they are intended for.. I'm sure most of the people would.. There are however situations where goto is what makes sense.. I'm still waiting

RE: [PHP-DEV] GOTO operator

2004-08-02 Thread Robert Cummings
On Mon, 2004-08-02 at 23:08, Steph wrote: My point was to say it's powerful, as powerful as all those, not that it could replace them.. I would still use while(), do..while() and for() the times they are intended for.. I'm sure most of the people would.. There are however situations

Re: [PHP-DEV] GOTO operator

2004-08-01 Thread Zeev Suraski
At 15:45 31/07/2004, Derick Rethans wrote: Exceptions are an OO thing, and it makes NO sense to use them in procedural code. Goto is a good thing here. Can you explain why it makes no sense to use them in procedural code? It makes perfect sense for me, and they render 100.0% of the examples

Re: [PHP-DEV] GOTO operator

2004-08-01 Thread David Chen
Michael Walter [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Another possibility, possibly more concise, would be to introduce a scoped keyword (or similar) in the spirit of global: scoped $foo; might make $foo's destructor be called at the end of the current scope (whether

Re: [PHP-DEV] GOTO operator

2004-08-01 Thread Cris H
--- Sterling Hughes [EMAIL PROTECTED] wrote: also, when you start quoting djikstra in a php context, you've lost. goto is fine, fight the power! s/quoting djikstra/mentioning state machines/ also s/quoting djikstra/agonising about the algorithmic efficiency of goto versus switch/ Not

Re: [PHP-DEV] GOTO operator

2004-08-01 Thread Alan Knowles
if you have a look at a parser generated for PHP (eg. this - quite large file) http://cvs.php.net/co.php/pear/HTML_Template_Flexy/Flexy/Tokenizer.php?r=1.51 The original Java/C# stuff does switch/case, In PHP due to the fact you have to evaluate each switch, it used to be quite slow, I ended up

Re: [PHP-DEV] GOTO operator

2004-07-31 Thread Andi Gutmans
At 09:24 PM 7/30/2004 -0700, Sara Golemon wrote: c) I don't think you are creating the necessary switch_free's and other frees when jumping out of a scope unexpectedly. Entirely possible. The tests I've run don't complain but that doesn't mean something bad isn't happening. Thanks for

Re: [PHP-DEV] GOTO operator

2004-07-31 Thread tinys xuefer
how about: break label; ? just a thought From: Andi Gutmans [EMAIL PROTECTED] To: Sara Golemon [EMAIL PROTECTED],[EMAIL PROTECTED] Subject: Re: [PHP-DEV] GOTO operator Date: Sat, 31 Jul 2004 00:13:51 -0700 MIME-Version: 1.0 X-Sender: [EMAIL PROTECTED] Received: from pb1.pair.com ([216.92.131.4

Re: [PHP-DEV] GOTO operator

2004-07-31 Thread Jacques Marneweck
Hi Sara, I can see where I can similfy certain code on a project I coded which would reduce some major ugly code. Sure I could have rewritten the code in c but I prefered having something easier to maintain in the early hours of the morning. Drop me a line where I can find the updated patches

Re: [PHP-DEV] GOTO operator

2004-07-31 Thread Derick Rethans
On Fri, 30 Jul 2004, Aidan Lister wrote: Develop some wacky construct that you have to use instead... that way, it will scare off novice users, and expert programmers will HAVE to know what they're doing and know that they really need it before they have to implement it. It's along the

Re: [PHP-DEV] GOTO operator

2004-07-31 Thread Derick Rethans
On Wed, 28 Jul 2004, Sara Golemon wrote: I wrote up a patch for implementing gotos in php scripts a couple months ago as an exercise in working with the Zend engine. I put it aside assuming noone would actually want it, but Wez and Ilia convinced me to post it for consideration:

Re: [PHP-DEV] GOTO operator

2004-07-31 Thread Derick Rethans
On Fri, 30 Jul 2004, Edin Kadribasic wrote: On Friday 30 July 2004 00:43, Paul G wrote: [snip] This is exactly the kind of code that makes me miss goto so much for error handling. I agree with that, +1 on goto from me, but still... only constant labels please! Derick -- PHP Internals -

Re: [PHP-DEV] GOTO operator

2004-07-31 Thread Derick Rethans
On Fri, 30 Jul 2004, Jeff Moore wrote: On Jul 30, 2004, at 4:33 PM, Edin Kadribasic wrote: Jeff Moore wrote: Where did the if statements go? do_stuff(), do_more_stuff(), and do_even_more_stuff() should throw exceptions rather than return boolean error indicators. Now imagine

Re: [PHP-DEV] GOTO operator

2004-07-31 Thread Derick Rethans
On Thu, 29 Jul 2004, Sara Golemon wrote: *this* implementation of GOTO requires a hash lookup, however it could be reworked to use the same backpatching as the ZEND_JMP ops used with conditional statements. While doing that would speed execution time by skipping the hash lookup, it'd slow

Re: [PHP-DEV] GOTO operator

2004-07-31 Thread Derick Rethans
On Fri, 30 Jul 2004, Andi Gutmans wrote: At 10:31 PM 7/30/2004 +0200, Edin Kadribasic wrote: Andi Gutmans wrote: [snip] I didn't say it cannot be done with goto emulation (and abuse of a feature on par with switch(true)). What I mean is that using the real thing makes code more readable

Re: [PHP-DEV] GOTO operator

2004-07-31 Thread Michael Walter
Hiho, Paul G wrote: - Original Message - From: Andi Gutmans [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, July 30, 2004 2:08 PM Subject: Re: [PHP-DEV] GOTO operator --- snip --- I'm sorry but I just don't understand the great need for goto in PHP

Re: [PHP-DEV] GOTO operator

2004-07-31 Thread Andrey Hristov
Sara Golemon wrote: Thanks for the pointers, I at least see what I need to be exploring now (though I havn't sat down to unfold its meaning yet). Cetainly the implementation given earlier needs work whether its to make it work as advertised or in the more limited fashion suggested in other posts.

Re: [PHP-DEV] GOTO operator

2004-07-31 Thread Paul G
- Original Message - From: Michael Walter [EMAIL PROTECTED] To: Paul G [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Saturday, July 31, 2004 1:59 PM Subject: Re: [PHP-DEV] GOTO operator --- snip --- presumably, you see the need in C because it's the cleanest way to free() all you've

Re: [PHP-DEV] GOTO operator

2004-07-31 Thread Rasmus Lerdorf
On Sat, 31 Jul 2004, Paul G wrote: actually, alloc/dealloc was just used as an example. it could be anything - rollback, closing sockets, pretty much any sort of 'undoing' that you need to do to make it look like nothing ever happened ;) what you are suggesting is similar to the hack i'm using

Re: [PHP-DEV] GOTO operator

2004-07-31 Thread Sara Golemon
How does the GOTO implementation handle this script1.php ?php do_some_stuff(); include script2.php; label: echo Hello ? script2.php: ?php declare_some_funcs(); some code ... if (some_cond) { goto label; } other code ? Included files

Re: [PHP-DEV] GOTO operator

2004-07-31 Thread Sterling Hughes
i'm just piping up that i'm a strong +1 on goto, its immensely useful for code generators, like for example a gui application that wanted to generate some type of php code. also, when you start quoting djikstra in a php context, you've lost. goto is fine, fight the power! -sterling On Sat,

Re: [PHP-DEV] GOTO operator

2004-07-31 Thread Michael Walter
Paul G wrote: - Original Message - From: Michael Walter [EMAIL PROTECTED] To: Paul G [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Saturday, July 31, 2004 1:59 PM Subject: Re: [PHP-DEV] GOTO operator --- snip --- presumably, you see the need in C because it's the cleanest way to free() all

Re: [PHP-DEV] GOTO operator

2004-07-31 Thread Andi Gutmans
PROTECTED] Sent: Saturday, July 31, 2004 1:59 PM Subject: Re: [PHP-DEV] GOTO operator --- snip --- presumably, you see the need in C because it's the cleanest way to free() all you've malloc()ed along the way, regardless of where you've errored out. in PHP, you've got gc, which (again presumably) makes you

Re: [PHP-DEV] GOTO operator

2004-07-31 Thread Michael Walter
: - Original Message - From: Michael Walter [EMAIL PROTECTED] To: Paul G [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Saturday, July 31, 2004 1:59 PM Subject: Re: [PHP-DEV] GOTO operator --- snip --- presumably, you see the need in C because it's the cleanest way to free() all you've malloc()ed along

Re: [PHP-DEV] GOTO operator

2004-07-31 Thread Andi Gutmans
: Paul G wrote: - Original Message - From: Michael Walter [EMAIL PROTECTED] To: Paul G [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Saturday, July 31, 2004 1:59 PM Subject: Re: [PHP-DEV] GOTO operator --- snip --- presumably, you see the need in C because it's the cleanest way to free() all

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Jan Dittmer
Andrey Hristov wrote: Robert Cummings wrote: Unmaintainable because of the ability to write cryptic code. There's nothing cryptic about: ...code goto cleanup: ...code cleanup: do { .code... if (something) break; ...code } while (0); ...cleanup code... This works for

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Andi Gutmans
At 04:55 PM 7/29/2004 -0700, Sara Golemon wrote: Ack! Gods no Andi is already winding up to rip me a new one for prematurely committing the patch earlier today, don't push him over the edge by suggesting das uberevil ini options, even in jest! ;) -Sara P.S. - Andi: Ya know I love ya more than

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Sascha Schumann
Why give our developers yet another way of shooting themselves in the foot? Or should I say, blow off their leg? :) Seconded. - Sascha -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP-DEV] GOTO operator

2004-07-30 Thread Richard Mann
Why give our developers yet another way of shooting themselves in the foot? Or should I say, blow off their leg? :) Third. I think GoTo is a bad diretion to go in, espetially with the direction PHP is currently taking with OOP. -- PHP Internals - PHP Runtime Development Mailing List To

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Edin Kadribasic
Andi Gutmans wrote: [snip] However, I think before talking about implementation, we need to decide if goto is really good for PHP. As I mentioned earlier, goto is one of the few features that I really missed in the language for the past several years I've been using PHP. We can debate until the

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Lester Caine
Edin Kadribasic wrote: However, I think before talking about implementation, we need to decide if goto is really good for PHP. As I mentioned earlier, goto is one of the few features that I really missed in the language for the past several years I've been using PHP. We can debate until the end

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Paul G
- Original Message - From: Jevon Wright [EMAIL PROTECTED] To: Frank M. Kromann [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, July 30, 2004 6:53 AM Subject: Re: [PHP-DEV] GOTO operator Why not make it hard for users to use GOTO in the first place? how about a --with-more-rope

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Ilia Alshanetsky
On July 30, 2004 02:43 am, Andi Gutmans wrote: At 04:55 PM 7/29/2004 -0700, Sara Golemon wrote: I think there are only two cases where goto is really interesting: a) Error handling. b) Auto-generating code or compiler compilers (Sterling mentioned these two). c) Anywhere recursive functions

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Dan Cox
The main argument against providing the 'goto' statement seems to be to protect users from themselves. So, let's analyze the situation. In the languages which provide the 'goto' statement, is this functionality widely abused? I have used a number of Open Source projects in several different

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Aidan Lister
Develop some wacky construct that you have to use instead... that way, it will scare off novice users, and expert programmers will HAVE to know what they're doing and know that they really need it before they have to implement it. It's along the lines of make the most dangerous stuff the

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Hartmut Holzgraefe
Lester Caine wrote: Personally I see NO advantage to GOTO in a structured language, and even if it is added I've learnt enough in 30 years to avoid it. Surely CASE is much safer and naturally 'contained'? Two words: State machine -- Hartmut Holzgraefe [EMAIL PROTECTED] -- PHP Internals - PHP

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Hartmut Holzgraefe
Robert Cummings wrote: C has it C++ has it VB has it Lisp has GO which is pretty much the same Perl I'm sure many other too. Even PASCAL, the mother of structured code languages, has it! -- Hartmut Holzgraefe [EMAIL PROTECTED] -- PHP Internals - PHP Runtime Development Mailing List To

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Shaun Thomas
Paul G wrote: function pseudocode() { $a=allocate_resource_z(); $b=allocate_resource_y(); $res=do_stuff(); if(!$res) goto err_out; $c=allocate_resource_x(); $res=do_more_stuff(); if(!$res) goto err_out; $d=allocate_resource_foo();

RE: [PHP-DEV] GOTO operator

2004-07-30 Thread Joseph Lee
Hartmut Holzgraefe wrote: Robert Cummings wrote: C has it C++ has it VB has it Lisp has GO which is pretty much the same Perl I'm sure many other too. Even PASCAL, the mother of structured code languages, has it! Python too! ;) http://www.entrian.com/goto/ ;) -- PHP Internals -

RE: [PHP-DEV] GOTO operator

2004-07-30 Thread Bernard Fouché
Hi there. I'm one of the many readers of the list but not contributing myself since I've no knowledge of the internals of PHP. However I'd like to make the following comments about 'goto', addressed to people opposing its introduction in PHP: - If you consider the 'good way of writing code',

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Lester Caine
Hartmut Holzgraefe wrote: Personally I see NO advantage to GOTO in a structured language, and even if it is added I've learnt enough in 30 years to avoid it. Surely CASE is much safer and naturally 'contained'? Two words: State machine So what - the database tells me what to run next for each

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Robert Cummings
On Fri, 2004-07-30 at 06:05, Lester Caine wrote: Edin Kadribasic wrote: However, I think before talking about implementation, we need to decide if goto is really good for PHP. As I mentioned earlier, goto is one of the few features that I really missed in the language for the past

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Andi Gutmans
Rob, First of all I don't know where you are getting O(n) from because the operation is O(1). Secondly, I just don't understand what the sudden necessity for the goto construct is when over the years we have barely ever had a PHP developer asking for it. And please guys, don't use C

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Sara Golemon
But reading the various posts here, I changed a little my opinion. I'm in favor of a goto operator if the scope of its labels is limited to, say, a function/method only. And that's precisely how this implementation of GOTO behaves. You can only jump to a label within the same op array. That

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Ilia Alshanetsky
On July 30, 2004 01:11 pm, Andi Gutmans wrote: Secondly, I just don't understand what the sudden necessity for the goto construct is when over the years we have barely ever had a PHP developer asking for it. That can be said for virtually any new functionality that was added to PHP. Looking

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Sara Golemon
Richard Mann [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I think GoTo is a bad diretion to go in, espetially with the direction PHP is currently taking with OOP. Let me respond by telling you what I hear: I have no use for goto therefore noone else should be able to use it.

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Sara Golemon
Secondly, I just don't understand what the sudden necessity for the goto construct is when over the years we have barely ever had a PHP developer asking for it. We clearly travel in different circles. I've heard GOTO requested at least monthly from a different person each time and have never

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Andi Gutmans
At 01:29 PM 7/30/2004 -0400, Ilia Alshanetsky wrote: On July 30, 2004 01:11 pm, Andi Gutmans wrote: Secondly, I just don't understand what the sudden necessity for the goto construct is when over the years we have barely ever had a PHP developer asking for it. That can be said for virtually any

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Andi Gutmans
At 10:32 AM 7/30/2004 -0700, Sara Golemon wrote: Secondly, I just don't understand what the sudden necessity for the goto construct is when over the years we have barely ever had a PHP developer asking for it. We clearly travel in different circles. I've heard GOTO requested at least monthly

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Edin Kadribasic
On Friday, Jul 30, 2004, at 19:38 Europe/Copenhagen, Andi Gutmans wrote: At 01:29 PM 7/30/2004 -0400, Ilia Alshanetsky wrote: On July 30, 2004 01:11 pm, Andi Gutmans wrote: Secondly, I just don't understand what the sudden necessity for the goto construct is when over the years we have barely

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Andi Gutmans
At 07:48 PM 7/30/2004 +0200, Edin Kadribasic wrote: a) Most of the OOP functionality was requested by a huge amount of PHP developers I've talked to. b) I don't think internals@ is a reflection of the PHP community. Most people here fall into the category of very advanced developers. Doesn't

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Ilia Alshanetsky
On July 30, 2004 01:38 pm, Andi Gutmans wrote: a) Most of the OOP functionality was requested by a huge amount of PHP developers I've talked to. I cannot comment on that as I can't hardly comment on the people you spoke with. What I personally heard about OO primary request from developers

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Edin Kadribasic
On Friday, Jul 30, 2004, at 19:52 Europe/Copenhagen, Andi Gutmans wrote: Come on. I can't even believe we are arguing about this. I really can't believe this PHP is only for morons attitude that comes from time to time here on internals. It's not only for morons but the PHP spirit has always been

RE: [PHP-DEV] GOTO operator

2004-07-30 Thread Ford, Mike [LSS]
On 30 July 2004 18:45, Andi Gutmans wrote: At 10:32 AM 7/30/2004 -0700, Sara Golemon wrote: Secondly, I just don't understand what the sudden necessity for the goto construct is when over the years we have barely ever had a PHP developer asking for it. We clearly travel in

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Andi Gutmans
At 01:53 PM 7/30/2004 -0400, Ilia Alshanetsky wrote: b) I don't think internals@ is a reflection of the PHP community. If this is the case, why are we even bothering to discuss relevant to PHP issues on this list? If people who read/write to this list do not reflect the community perhaps we

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Rasmus Lerdorf
Since a few of you have poked me about this thread now... First, internals@ is the place where we make decisions like this. We don't poll the community or any such sillyness. We use our collective experience to make a decision. I personally can easily live without GOTO, but I really don't see

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Paul G
- Original Message - From: Andi Gutmans [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, July 30, 2004 2:08 PM Subject: Re: [PHP-DEV] GOTO operator --- snip --- I'm sorry but I just don't understand the great need for goto in PHP and that is coming from

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Ilia Alshanetsky
On July 30, 2004 02:08 pm, Andi Gutmans wrote: I'm not saying that. I'm just saying that you should not only think of yourself as a user but of everyone (i.e. make sure you put yourself in the shoes of others and try and base your position on that). If you think the majority of PHP users

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Zeev Suraski
FWIW, I also think that introducing goto into the language is not a good idea. Yes, I agree with Wez and Ilia who said that it can be excellent if people are taught when and how to use it well. Which is exactly why I think it's a bad idea to put it into a language like PHP - where the barrier

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Stefan Esser
Hi, actually so far my only comment on this thing was my ironical mail about removing try and catch because it is more or less the same as goto. I think goto is quite similar. There have been no very compelling arguments in favor. Some of them don't hold because of break n and the few that are

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Zeev Suraski
At 21:19 30/07/2004, Ilia Alshanetsky wrote: It seemed to me like people have raised numerous valid argument and have even gone as far as to back them up with examples. If you need more of those, then surely the supporters of goto can provide them. But let's make the decision based on technical

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Zeev Suraski
At 20:48 30/07/2004, Edin Kadribasic wrote: On Friday, Jul 30, 2004, at 19:38 Europe/Copenhagen, Andi Gutmans wrote: At 01:29 PM 7/30/2004 -0400, Ilia Alshanetsky wrote: On July 30, 2004 01:11 pm, Andi Gutmans wrote: Secondly, I just don't understand what the sudden necessity for the goto

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Todd Ruth
Something doesn't quite seem right to me about a position that has both of the following assertions: 1) goto should not be available 2) there's already an equivalent of goto available, so goto is not needed (and it's just fine that people use the equivalent) If you really believe 1,

  1   2   >