Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » PHP
  • » [PHP-DEV] Labeled Break (nothing at all whatsoever to do withGOTO) [RSS Feed]

#1 Nov. 30, 2005 02:38:34

Sara G.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Labeled Break (nothing at all whatsoever to do withGOTO)


Hello Sara,

nice work, clean patch, good solution - thanks! what more can one
say?commit? :)Oh how you both love to tease me :pIt occured to me on the way onto the train that this construct doesn't needpass_two(). When I get home to more bandwidth I'll cook up a simplifiedversion that resolves break distance in zend_do_brk_cont() and frees thelabels in do_end_loop().-Sara

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#2 Nov. 30, 2005 02:41:56

Sara G.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Labeled Break (nothing at all whatsoever to do withGOTO)


Hello, I represent group B (not in any way officially or anything else
that might give my words an iota of weight), but I (*cough cough*) WE
think that the above break system would make a terrible system for
finite state machines.Good, 'cause that's not its purpose. This doesn't supplant GOTO or precludeit. This is a different topic about a different feature which just happensto touch on SOME similar talking points.Additionally at this time I'd like to make clear that we are in support
for full uncrippled break WITHIN scope. Group A can feel free to travel
to the burning fires of hell and have a barbecue, and group C should
join us so that at least they get what they want as a subset.Lead on the charge good sir... lead on.As an aside, from what I've read, the multitude were in favour of
unrestricted goto. Quite a few were in favour of none at all (but not as
many as in group B) and those in favour of none at all had a large
subset that were in favour of unrestricted goto in the event that group
B should get their way :)Not to put too fine a point on it, but there's a limited subset of thevoices on this list that carry the weight needed to push a feature like gotointo the engine. Amongst those voices there is a much less decisive quorum.-Sara--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#3 Nov. 30, 2005 04:16:08

Sara G.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Labeled Break (nothing at all whatsoever to do withGOTO)


It occured to me on the way onto the train that this construct doesn'tneed pass_two(). When I get home to more bandwidth I'll cook up asimplified version that resolves break distance in zend_do_brk_cont() andfrees the labels in do_end_loop().Okay, simpler/leaner implementation now available. The new version onlytouches zend_compile. and zend_language_parser.y though thefunctionality is the same.http://libssh2.org/patches/true_labeled_break.diff-Sara

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#4 Nov. 30, 2005 08:10:51

Dmitry S.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Labeled Break (nothing at all whatsoever to do withGOTO)


Is it possible to not extend "zend_brk_cont_element" structures? They are
used during runtime.

Thanks. Dmitry.

> -----Original Message-----
> From: Sara Golemon
> Sent: Wednesday, November 30, 2005 7:18 AM
> To: intern***@*ists.php.net
> Subject: Re: Labeled Break (nothing at all
> whatsoever to do withGOTO)
>
>
> > It occured to me on the way onto the train that this
> construct doesn't
> > need pass_two(). When I get home to more bandwidth I'll cook up a
> > simplified version that resolves break distance in
> zend_do_brk_cont() and
> > frees the labels in do_end_loop().
> >
> Okay, simpler/leaner implementation now available. The new
> version only
> touches zend_compile. and zend_language_parser.y though the
> functionality is the same.
>
>http://libssh2.org/patches/true_labeled_break.diff>
> -Sara
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit:http://www.php.net/unsub.php>
>

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#5 Nov. 30, 2005 21:20:31

Bart d.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Labeled Break (nothing at all whatsoever to do withGOTO)


devils advocate:what happens when I want to place a 'goto' label just before a while orforeachloop (upon which I haven't put a label)? I ask because I assume that thefollowing 2statements should be identical no:?I think there would be no such thing as a 'goto' or 'break' label. Therewould be just labels. You could use them with 'goto' and/or 'break'together:goto LABEL:

...

LABEL:while (cond) {
if (cond)
break LABEL;
}

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#6 Nov. 30, 2005 23:12:35

Sara G.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Labeled Break (nothing at all whatsoever to do withGOTO)


what happens when I want to place a 'goto' label just before a while orforeachloop (upon which I haven't put a label)? I ask because I assume that thefollowing 2statements should be identical no:?

<?php
LABEL: while(1) {
/* ..etc */
?>

<?php
LABEL:
while(1) {
/* ..etc */
?>PHP's parser gives no importance to whitespace, so yes, these two areidentical.In the dual-purpose vision I had for these labels, all labels would beusable as GOTO targets. Labels which are followed *immediately* by a breakcontainer construct (for, foreach, while, do-while, switch) would also beusable as break/continue targets.Note that in these example, goto LABEL; and continue lABEL; are *not* thesame statement. Goto would restart state loops such as for() and foreach()from initial positions.-Sara--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#7 Dec. 1, 2005 08:42:12

Jochem M.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Labeled Break (nothing at all whatsoever to do withGOTO)


thanks for the explanation Sara, :-), as always your manner and ideas
are an example to the 'php core', 'we' (they) are lucky to have you :-)

Sara Golemon wrote:what happens when I want to place a 'goto' label just before a whileor foreachloop (upon which I haven't put a label)? I ask because I assume thatthe following 2statements should be identical no:?

<?php
LABEL: while(1) {
/* ..etc */
?>

<?php
LABEL:
while(1) {
/* ..etc */
?>PHP's parser gives no importance to whitespace, so yes, these two areidentical.In the dual-purpose vision I had for these labels, all labels would beusable as GOTO targets. Labels which are followed *immediately* by abreak container construct (for, foreach, while, do-while, switch) wouldalso be usable as break/continue targets.Note that in these example, goto LABEL; and continue lABEL; are *not*the same statement. Goto would restart state loops such as for() andforeach() from initial positions.-Sara--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#8 Dec. 1, 2005 10:47:08

Dmitry S.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Labeled Break (nothing at all whatsoever to do withGOTO)


Hi Sara,

I made another patch that is based on your ideas.

1) It uses "right" syntax:

LABEL: while(1) {
break LABEL;
}

2) It doesn't allow usage of same label for different loops

L1: while(1) {...}
L1: while(1) {...}

3) It doesn't use executor data structures

4) It allows reuse of same labels for jump/goto (as was done in your first
patch).
It already declares "jump LABEL;" operator but emits error for now.

I think this patch can be committed and then we can discuss jump/goto.

Thanks. Dmitry.--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#9 Dec. 1, 2005 16:02:53

Sara G.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Labeled Break (nothing at all whatsoever to do withGOTO)


We're definately on the same page as far as implementation goals, but Ican't help but notice one problem:* labels aren't scoped to functions. The break container checks preventcasual jumping, but:FOO: do { } while (0);
function bar() {
do { break FOO; } while (0);
}Actually compiles legally. Of course the actual break stays within itslocal container, but if/when Jump is introduced to the mix....well... allbets are off...-Sara----- Original Message -----From: "Dmitry Stogov" <>To: "'Sara Golemon'" <>; <intern***@*ists.php.net>
Cc: "Zeev Suraski" <>; "Stanislav Malyshev" <>
Sent: Thursday, December 01, 2005 2:45 AMSubject: RE: Labeled Break (nothing at all whatsoever to dowithGOTO)Hi Sara,

I made another patch that is based on your ideas.

1) It uses "right" syntax:

LABEL: while(1) {
break LABEL;
}

2) It doesn't allow usage of same label for different loops

L1: while(1) {...}
L1: while(1) {...}

3) It doesn't use executor data structures

4) It allows reuse of same labels for jump/goto (as was done in your first
patch).
It already declares "jump LABEL;" operator but emits error for now.

I think this patch can be committed and then we can discuss jump/goto.

Thanks. Dmitry.--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#10 Dec. 1, 2005 16:45:22

Stanislav M.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Labeled Break (nothing at all whatsoever to do withGOTO)


SG>>* labels aren't scoped to functions. The break container checks prevent
SG>>casual jumping, but:
SG>>
SG>>FOO: do { } while (0);
SG>>function bar() {
SG>> do { break FOO; } while (0);
SG>>}

This shouldn't work, of course.
--
Stanislav Malyshev, Zend Products Engineer
http://www.zend.com/+972-3-6139665 ext.115

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

  • Root
  • » PHP
  • » [PHP-DEV] Labeled Break (nothing at all whatsoever to do withGOTO) [RSS Feed]

Board footer

Moderator control

Enjoy the 23rd of April
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support