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-19 Thread Sascha Schumann
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 them. How that? C doesn't have dynamic goto

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 f

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 ei

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 c

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 p

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 P

Re: [PHP-DEV] GOTO operator

2004-08-18 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 m

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

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

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 B

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

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 p

Re: [PHP-DEV] GOTO operator

2004-08-18 Thread Hartmut Holzgraefe
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 people -- Hartmut Holzgraefe

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 o

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 be

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 yo

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 A

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 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 tinys xuefer
ace to ask 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

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

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

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

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

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 th

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

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 le

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 o

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

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 situat

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 wai

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 Sa

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
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: dvdmandt¤telia

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 con

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 th

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

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 scop

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 shown

Re: [PHP-DEV] GOTO operator

2004-07-31 Thread Andi Gutmans
200, Michael Walter wrote: 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 --- pre

Re: [PHP-DEV] GOTO operator

2004-07-31 Thread Michael Walter
ul 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&#x

Re: [PHP-DEV] GOTO operator

2004-07-31 Thread Andi Gutmans
"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 the way, regardless of where you'

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

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

Re: [PHP-DEV] GOTO operator

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

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 us

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 nee

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

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

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

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

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

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 on

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 PROTEC

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.

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Sara Golemon
> > > 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 the pointers, I at least see what I

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread David Chen
"Andrey Hristov" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Jan Dittmer wrote: > > Andrey Hristov wrote: > > > >> Robert Cummings wrote: > >> > >>> > >>> > >>> Unmaintainable because of the ability to write cryptic code. There's > >>> nothing cryptic about: > >>> > >>> ...cod

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Jeremy Johnstone
Personally I would never use it myself, as I know of better ways around it which make more sense to me. But on the other hand if it would help others then more power to yah. I think the argument of user's abusing it is bogus, as clearly mentioned in this thread. There isn't a WTF factor, as almo

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Elfyn McBratney
Hello, On Thu, Jul 29, 2004 at 11:43:13PM -0700, Andi Gutmans wrote: > [...] > > Let's for a second skip discussion of the patch itself, because although it > was an interesting exercise the patch is not production ready. > However, I think before talking about implementation, we need to decide

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Jason Garber
Hello Andi, That being said, I TOTALLY agree with your 2 rules. Thanks. Also, by limiting it to local scope and not being able to jump into an execution block would limit it's ability to make really nasty spaghetti code -AND- in my understanding provide the desired "professional" funct

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Andi Gutmans
At 09:19 PM 7/30/2004 -0400, Robert Cummings wrote: On Fri, 2004-07-30 at 21:16, Jason Garber wrote: > Hello Andi, > > Sorry for being unclear on this, but what is the exact definition of > an "execution block" in this context? Can't jump into an "if" block or "while" block etc. Only out. Yep e

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Robert Cummings
On Fri, 2004-07-30 at 21:16, Jason Garber wrote: > Hello Andi, > > Sorry for being unclear on this, but what is the exact definition of > an "execution block" in this context? Can't jump into an "if" block or "while" block etc. Only out. Cheers, Rob. -- .

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Jason Garber
Hello Andi, Sorry for being unclear on this, but what is the exact definition of an "execution block" in this context? Thanks! -- Best regards, Jasonmailto:[EMAIL PROTECTED] Friday, July 30, 2004, 9:08:09 PM, you wrote: AG> Hi Jason, AG> I think that in any

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Andi Gutmans
Hi Jason, I think that in any case, if it is implemented it will have to follow two basic rules: a) The goto has to be local. b) You can't jump into an execution block but only out of one. Andi At 09:06 PM 7/30/2004 -0400, Jason Garber wrote: PG> [snip] i'm somewhat confuzzled why you, of all peo

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Jason Garber
PG> [snip] i'm somewhat confuzzled why you, of all people, are advocating such PG> mutilation of do-while(), which is *abuse* of the construct. mutilating one PG> construct to emulate another construct, which won't be implemented because PG> it could be abused and mutilated, just doesn't compute fo

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Paul G
- Original Message - From: "Andi Gutmans" <[EMAIL PROTECTED]> To: "Edin Kadribasic" <[EMAIL PROTECTED]>; "Zeev Suraski" <[EMAIL PROTECTED]> Cc: "Jeff Moore" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; <[EMAIL PR

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Robert Cummings
On Fri, 2004-07-30 at 17:11, Shaun Thomas wrote: > Hartmut Holzgraefe wrote: > > > The JAVA approach is even superior to PHPs "break n;" > > where n has to be an integer and you have to be very > > carefull to not wrap another loop around the break > > but within the loop supposed to be broken >

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Jeff Moore
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 do_stuff() and friends were native PHP functions ;) You mi

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Shaun Thomas
Hartmut Holzgraefe wrote: The JAVA approach is even superior to PHPs "break n;" where n has to be an integer and you have to be very carefull to not wrap another loop around the break but within the loop supposed to be broken Very true. Labeled breaks would be the "goto" that people seem to want

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Shaun Thomas
Jeff Moore wrote: function pseudocode() { try { $a = allocate_resource_z(); $b = allocate_resource_y(); $res = do_stuff(); $c = allocate_resource_x(); $res = do_more_stuff(); $d = allocate_resource_foo(); $res = do_even_more_stuff();

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Edin Kadribasic
David Kingma 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 do_stuff() and friends were native PHP functions ;) Good point, but should we fix this with a goto operator

RE: [PHP-DEV] GOTO operator

2004-07-30 Thread David Kingma
>> 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 do_stuff() and friends were native PHP functions ;) Good point, but should we fix this with a goto operator or get

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Hartmut Holzgraefe
Andi Gutmans wrote: so you are replacing the question "where does it go to" that can be answered with a string search wiht "where does it break to" This one alone justifies at least labeled breaks as JAVA has them and that are a kind of restricted GOTO (as you can also break out of an if) The JAVA

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Andi Gutmans
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 and maintinable. Add another level of nesting and

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Edin Kadribasic
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 do_stuff() and friends were native PHP functions ;) Edin -- PHP Internals - PHP Runtime Development Mailing Li

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Edin Kadribasic
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 and maintinable. Add another level of nesting and do/while becomes even harder to read. Edin -- PHP

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Jeff Moore
On Jul 30, 2004, at 10:35 AM, Shaun Thomas wrote: 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;

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Zeev Suraski
At 22:53 30/07/2004, Edin Kadribasic wrote: [snip] And can you explain why you can't solve this with exceptions in 2 minutes? And please, stop the 'dictator!' accusations. If whatever came out of my mouth was immediately implemented in PHP, we'd have libxml2 bundled and SOAP support built-in (ju

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Andi Gutmans
At 09:53 PM 7/30/2004 +0200, Edin Kadribasic wrote: function pseudocode() { $a=allocate_resource_z(); $b=allocate_resource_y(); do { $res=do_stuff(); if(!$res) break; $c=allocate_resource_x(); $res=do_more_stuff(); if(!$res) break; $d=allocate_resourc

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Edin Kadribasic
Zeev Suraski wrote: At 22:26 30/07/2004, Edin Kadribasic wrote: On Friday, Jul 30, 2004, at 21:16 Europe/Copenhagen, Zeev Suraski wrote: My 2c - we shouldn't discuss the implementation in the same context as whether we should have it, because it moves the focus away from the source of the problem

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Ilia Alshanetsky
Zeev, First, thanks for the complement ;-). I doubt most people became great programmers overnight. Most people have learned with time, often from their own mistakes or mistakes they observed others doing. Restricting a language can limit how badly you can screw up, but it also limits what cou

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Robert Cummings
On Fri, 2004-07-30 at 15:13, Andi Gutmans wrote: > At 03:11 PM 7/30/2004 -0400, Robert Cummings wrote: > >On Fri, 2004-07-30 at 13:11, Andi Gutmans wrote: > > > 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

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Zeev Suraski
At 22:26 30/07/2004, Edin Kadribasic wrote: On Friday, Jul 30, 2004, at 21:16 Europe/Copenhagen, Zeev Suraski wrote: My 2c - we shouldn't discuss the implementation in the same context as whether we should have it, because it moves the focus away from the source of the problem, which is not imple

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Edin Kadribasic
On Friday, Jul 30, 2004, at 21:16 Europe/Copenhagen, Zeev Suraski wrote: My 2c - we shouldn't discuss the implementation in the same context as whether we should have it, because it moves the focus away from the source of the problem, which is not implementation. We're way beyond the times when

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Andi Gutmans
At 12:13 PM 7/30/2004 -0700, Sara Golemon wrote: > a) Performance wise the right thing to do is to use static labels and > pre-compute them during compile-time (I remembered you were aware of that). > b) We therefore should not require an additional opcode for goto. > I did consider that, but the i

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Zeev Suraski
My 2c - we shouldn't discuss the implementation in the same context as whether we should have it, because it moves the focus away from the source of the problem, which is not implementation. We're way beyond the times when we add something to PHP just because we can... I'm not saying we shoul

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Jacques Marneweck
+1 On Wed, 28 Jul 2004 22:55:53 -0400, Ilia Alshanetsky <[EMAIL PROTECTED]> wrote: > Goto is an extremely useful for parsers and makes life much easier when > dealing with complex error handling situations. > > +1 > > Ilia > > > > On July 28, 2004 10:12 pm, Sara Golemon wrote: > > I wrote up

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Sara Golemon
> a) Performance wise the right thing to do is to use static labels and > pre-compute them during compile-time (I remembered you were aware of that). > b) We therefore should not require an additional opcode for goto. > I did consider that, but the idea of computed targets (goto "foo$bar";) souded

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Andi Gutmans
At 03:11 PM 7/30/2004 -0400, Robert Cummings wrote: On Fri, 2004-07-30 at 13:11, Andi Gutmans wrote: > 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 o

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Robert Cummings
On Fri, 2004-07-30 at 13:11, Andi Gutmans wrote: > 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 devel

Re: [PHP-DEV] GOTO operator

2004-07-30 Thread Sara Golemon
"Sara Golemon" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > >The C# goto is limited: "goto statements can transfer control within > > >blocks and out of blocks, but never into blocks." Does the PHP goto > > >implementation have this limitation? > > > > > No it doesn't. As I men

  1   2   3   >