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 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.
I intend to put some work into it regardless of whether it'll be included or
not.  As I mentioned originally, this entire effort was meant as a learning
exercise, and it's doing that job.  If it's used: great.  If not, it'll just
stay where it is and those who want it can still patch it in.
Sara,
Feel free to email me personally and I can help you out and give you advice 
on what you should be looking at.

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


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]) by mc9-f26.hotmail.com with 
Microsoft SMTPSVC(5.0.2195.6824); Sat, 31 Jul 2004 00:14:21 -0700
Received: (qmail 21507 invoked by uid 1010); 31 Jul 2004 07:14:12 -
Received: (qmail 21456 invoked by uid 1010); 31 Jul 2004 07:14:11 -
X-Message-Info: JGTYoYF78jEhitu4NH5K6pJRNQwoa+2D
Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
Precedence: bulk
list-help: mailto:[EMAIL PROTECTED]
list-unsubscribe: mailto:[EMAIL PROTECTED]
list-post: mailto:[EMAIL PROTECTED]
Delivered-To: mailing list [EMAIL PROTECTED]
Delivered-To: [EMAIL PROTECTED]
Delivered-To: [EMAIL PROTECTED]
Message-Id: [EMAIL PROTECTED]
X-Mailer: QUALCOMM Windows Eudora Version 5.1
In-Reply-To: [EMAIL PROTECTED]
References: [EMAIL PROTECTED] 
[EMAIL PROTECTED] 
[EMAIL PROTECTED] [EMAIL PROTECTED] 
[EMAIL PROTECTED] 
[EMAIL PROTECTED] 
[EMAIL PROTECTED] 
[EMAIL PROTECTED]
Return-Path: [EMAIL PROTECTED]
X-OriginalArrivalTime: 31 Jul 2004 07:14:21.0331 (UTC) 
FILETIME=[00488630:01C476CE]

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 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.
I intend to put some work into it regardless of whether it'll be included 
or
not.  As I mentioned originally, this entire effort was meant as a 
learning
exercise, and it's doing that job.  If it's used: great.  If not, it'll 
just
stay where it is and those who want it can still patch it in.
Sara,
Feel free to email me personally and I can help you out and give you advice 
on what you should be looking at.

Andi
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
_
Add photos to your messages with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail

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


Re: [PHP-DEV] Everyone on the road?

2004-07-31 Thread Wez Furlong
I'm supposed to be writing this weekend, so technically I shouldn't
have time to dig into it until next weekend.
That means that I probably will find some time this weekend ;-)

--Wez.

On Fri, 30 Jul 2004 15:05:13 -0700, Andi Gutmans [EMAIL PROTECTED] wrote:
 By the way, Sara, Wez, did you see Rasmus's email about the double stat? Do
 you know where it's coming from?
 
 Andi

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



Re: [PHP-DEV] Everyone on the road?

2004-07-31 Thread Wez Furlong
Nuked duplicate fstats in HEAD.

On Sat, 31 Jul 2004 10:05:12 +0100, Wez Furlong [EMAIL PROTECTED] wrote:
 I'm supposed to be writing this weekend, so technically I shouldn't
 have time to dig into it until next weekend.
 That means that I probably will find some time this weekend ;-)
 
 --Wez.
 
 
 
 On Fri, 30 Jul 2004 15:05:13 -0700, Andi Gutmans [EMAIL PROTECTED] wrote:
  By the way, Sara, Wez, did you see Rasmus's email about the double stat? Do
  you know where it's coming from?
 
  Andi


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



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 once they have
been released.

Regards
--jm

On Fri, 30 Jul 2004 21:24:20 -0700, Sara Golemon [EMAIL PROTECTED] 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 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.
 
 I intend to put some work into it regardless of whether it'll be included or
 not.  As I mentioned originally, this entire effort was meant as a learning
 exercise, and it's doing that job.  If it's used: great.  If not, it'll just
 stay where it is and those who want it can still patch it in.
 
 -Sara
 
 
 
 --
 PHP Internals - PHP Runtime Development Mailing List
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
Jacques Marneweck
http://www.powertrip.co.za/blog/

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



Re: [PHP-DEV] [PATCH] tests/classes/array_access001.phpt

2004-07-31 Thread Derick Rethans
On Thu, 22 Jul 2004, Marcus Boerger wrote:

 all tests PASS for me as doo show all QA reports. There must be
 something else. What do you see Derick, PASS or FAIL?

I've no idea. I was just wondering why he changed the test while there
was no real reason for it afaik.

Derick

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



Re: [PHP-DEV] Spammer on Bugs page

2004-07-31 Thread Derick Rethans
On Thu, 29 Jul 2004, Jakub Vrana wrote:

 Derick Rethans wrote:
   Perhaps limiting the number of bug report by IP per day and/or limiting
   the number of bugs with the same words should be implemented.
  I agree. No one likes Write here the text from image.
  IPs can be easily spoofed; we want a turing test.

 Will you agree with this procedure?

 1. Client sends filled form.

 2. Ticket (random number) is created, saved on the server together with
 client's IP address and sent to the client.

IP tracking will not work always, so we can't do that.


 3. If correct ticket arrives, data are published. Old tickets can be
 deleted after some time.

 IP spoofing is useless in this case, only network listening can be used
 and it's not so easy.

 + Limiting the number of bug report per IP of course.

That is useless.

Derick

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



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 lines of make the most dangerous stuff the
  hardest to do.

 I think this is probably one of the best ideas...

  I'm not sure how, though... a huge language construct
  (goto_this_line_please)? Use numbers instead of labels? Relative jumping?
  Require extra messages? A weird symbolic construct? *shrug*

 I'd just disable it by default, force them to compile --with-goto

 That definitely stops the novices, and allows experts to use it if they
 realy need it.

 Of course then portability then becomes a problem...

So this is yet-another-bogus-idea ;-)

Derick

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



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:

 Description:
 http://pecl.org

 Patch:
 http://pecl.org/patches/opcode_goto_5.1.0.diff

I think we should make it allow constant label names only, doing it
dynamically is just too confusing to read later on.

Derick

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



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 - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



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 do_stuff() and friends were native PHP functions ;)

 You might also have installed a standard error handler to raise some
 kinds of php errors as exceptions.

Exceptions are an OO thing, and it makes NO sense to use them in
procedural code. Goto is a good thing here.

Derick

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



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 compile time and remove the ability to
 use complex expressions as goto targets (i.e.  goto foo$i; ).

I think that's a good thing actually ;-)

Derick

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



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 and maintinable. Add another level of nesting and
 do/while becomes even harder to read.

 I just sent it out because I wanted people to see what it looks like. I
 think it's sexy :)

As sexy as a monkey in a dress you mean? :)

Derick

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



[PHP-DEV] Seg fault

2004-07-31 Thread Kevin Waterson
Well, no. I am running apache 1.3.31 and php 5.1.0

/php/dev/this/php5-200407310630/Zend/zend_constants.c(33) : Block 0x0087F563 status:
/php/dev/this/php5-200407310630/Zend/zend_variables.c(39) : Actual location (location 
was relayed)
Beginning:  Overrun (magic=0x75622E6E, expected=0x7312F8DC)
[Sun Aug  1 00:15:31 2004] [notice] child pid 19057 exit signal Segmentation fault (11)
[Sun Aug  1 00:15:31 2004] [notice] child pid 19059 exit signal Segmentation fault (11)

Kind regards
Kevin
-- 
 __  
(_ \ 
 _) )            
|  /  / _  ) / _  | / ___) / _  )
| |  ( (/ / ( ( | |( (___ ( (/ / 
|_|   \) \_||_| \) \)
Kevin Waterson
Port Macquarie, Australia

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



Re: [PHP-DEV] Seg fault

2004-07-31 Thread Wez Furlong
http://bugs.php.net/how-to-report.php

On Sun, 1 Aug 2004 00:20:08 +1000, Kevin Waterson [EMAIL PROTECTED] wrote:
 Well, no. I am running apache 1.3.31 and php 5.1.0
 
 /php/dev/this/php5-200407310630/Zend/zend_constants.c(33) : Block 0x0087F563 status:
 /php/dev/this/php5-200407310630/Zend/zend_variables.c(39) : Actual location 
 (location was relayed)
 Beginning:  Overrun (magic=0x75622E6E, expected=0x7312F8DC)
 [Sun Aug  1 00:15:31 2004] [notice] child pid 19057 exit signal Segmentation fault 
 (11)
 [Sun Aug  1 00:15:31 2004] [notice] child pid 19059 exit signal Segmentation fault 
 (11)
 
 Kind regards
 Kevin
 --
  __
 (_ \
  _) )           
 |  /  / _  ) / _  | / ___) / _  )
 | |  ( (/ / ( ( | |( (___ ( (/ /
 |_|   \) \_||_| \) \)
 Kevin Waterson
 Port Macquarie, Australia
 
 --
 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



Re: [PHP-DEV] Seg fault

2004-07-31 Thread Kevin Waterson
This one time, at band camp, Wez Furlong [EMAIL PROTECTED] wrote:

 http://bugs.php.net/how-to-report.php

http://www.bmezine.com/tattoo/A40305/high/dsc010660.jpg

maybe short tags is the problem..
-- 
 __  
(_ \ 
 _) )            
|  /  / _  ) / _  | / ___) / _  )
| |  ( (/ / ( ( | |( (___ ( (/ / 
|_|   \) \_||_| \) \)
Kevin Waterson
Port Macquarie, Australia

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



Re: [PHP-DEV] Seg fault

2004-07-31 Thread Wez Furlong
I don't see how that helps us to fix the problem.

--Wez.

-- 
    ___ _ ___
 / ___|/ _ \_   _/ _ \
| |  _| | | || || | | |
| |_| | |_| || || |_| |
 \|\___/ |_| \___/
Wez Furlong,
Glastonbury, Somerset, England


On Sun, 1 Aug 2004 00:39:24 +1000, Kevin Waterson [EMAIL PROTECTED] wrote:
 This one time, at band camp, Wez Furlong [EMAIL PROTECTED] wrote:
 
  http://bugs.php.net/how-to-report.php
 
 http://www.bmezine.com/tattoo/A40305/high/dsc010660.jpg
 
 maybe short tags is the problem..
 
 
 --
  __
 (_ \
  _) )           
 |  /  / _  ) / _  | / ___) / _  )
 | |  ( (/ / ( ( | |( (___ ( (/ /
 |_|   \) \_||_| \) \)
 Kevin Waterson
 Port Macquarie, Australia
 
 --
 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



Re: [PHP-DEV] Everyone on the road?

2004-07-31 Thread Andi Gutmans
:)
At 11:10 AM 7/31/2004 +0100, Wez Furlong wrote:
Nuked duplicate fstats in HEAD.
On Sat, 31 Jul 2004 10:05:12 +0100, Wez Furlong [EMAIL PROTECTED] wrote:
 I'm supposed to be writing this weekend, so technically I shouldn't
 have time to dig into it until next weekend.
 That means that I probably will find some time this weekend ;-)

 --Wez.



 On Fri, 30 Jul 2004 15:05:13 -0700, Andi Gutmans [EMAIL PROTECTED] wrote:
  By the way, Sara, Wez, did you see Rasmus's email about the double 
stat? Do
  you know where it's coming from?
 
  Andi

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


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 and
that is coming from someone who does see the need in C.

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 think we don't
need goto. i say that we alloc() stuff quite often, but it may be objects,
resources, what have you instead of chunks.
It's interesting that there is the desire for a low-level construct such 
as goto in order to implement scoped deallocation/deconstruction. I 
suppose something like C#' using() statement might help you in this 
case, although suggesting it will surely lead to another discussion ;)

Cheers,
Michael
yes, you can emulate it, but none of the emulations work equally well, ie
you need to update N lines of code when you add another alloc()ed resource,
error condition etc. error handling is not at all uncommon (at least it
shouldn't be =), quite a bunch of code is still procedural, more procedural
code is being written, and there is nothing wrong with that either in the
majority of cases (ie it works well for what is being done).
paul
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.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.
I intend to put some work into it regardless of whether it'll be included or
not.  As I mentioned originally, this entire effort was meant as a learning
exercise, and it's doing that job.  If it's used: great.  If not, it'll just
stay where it is and those who want it can still patch it in.
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
?
I think is again local scope because it's in main()
Concise, jumping between files that happen to be included.
thanks,
Andrey
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php


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 malloc()ed along the way, regardless of where you've errored
out.
  in PHP, you've got gc, which (again presumably) makes you think we don't
  need goto. i say that we alloc() stuff quite often, but it may be
objects,
  resources, what have you instead of chunks.
 It's interesting that there is the desire for a low-level construct such
 as goto in order to implement scoped deallocation/deconstruction. I
 suppose something like C#' using() statement might help you in this
 case, although suggesting it will surely lead to another discussion ;)

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 now and referred to in an earlier mail, ie
registering thingers to be 'undone'. while useful for certain things, it's
too verbose for the majority of situations When Done Here(tm).

paul

paul

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



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 now and referred to in an earlier mail, ie
 registering thingers to be 'undone'. while useful for certain things, it's
 too verbose for the majority of situations When Done Here(tm).

You pretty much have to use a shutdown function for this though.  By
default a PHP script will terminate if the listener goes away.  That is,
if someone starts loading the page and hits Stop or shuts down their
browser before you have written all your output, your script is
terminated as soon as it detects this so it is unlikely to ever run your
cleanup code in that case.  You need to register_shutdown_function() if
you have a critical cleanup thing that must be run, or you need to force
ignore_user_abort on in your config or at the beginning of your script to
make sure you are not aborted halfway through.

-Rasmus

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



[PHP-DEV] PHP 5.0.1

2004-07-31 Thread Andi Gutmans
As I mentioned about a week ago, I'd like to roll 5.0.1 (mainly due to the 
auth bug) and some other fixes.
I was thinking of rolling this minor release tomorrow or Tuesday. If you 
have any bug fixes you'd like to make in, please let me know. There's no 
problem with delaying it somewhat more...
Andi

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


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 are actually separate execution scopes (even though they're
shared data scope).  So the implementation referenced originally would raise
an error saing that 'label' is an undefined label.

-Sara

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



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, 31 Jul 2004 17:44:07 -0700, Sara Golemon [EMAIL PROTECTED] wrote:
  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 are actually separate execution scopes (even though they're
 shared data scope).  So the implementation referenced originally would raise
 an error saing that 'label' is an undefined label.
 
 -Sara
 
 
 
 --
 PHP Internals - PHP Runtime Development Mailing List
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
..II..

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



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 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 think we don't
need goto. i say that we alloc() stuff quite often, but it may be
objects,
resources, what have you instead of chunks.
It's interesting that there is the desire for a low-level construct such
as goto in order to implement scoped deallocation/deconstruction. I
suppose something like C#' using() statement might help you in this
case, although suggesting it will surely lead to another discussion ;)

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 ;)
Of course, what makes you think C#'s using() is restricted to deallocation?
 what you are suggesting
is similar to the hack i'm using now and referred to in an earlier mail, ie
registering thingers to be 'undone'. while useful for certain things, it's
too verbose for the majority of situations When Done Here(tm).
Actually what I was throwing into the discussion is IMO often the 
cleaner solution. You encapsulate _both_ construction and destruction 
logic into the same object, and as a client you just use the using() 
statement in order to have the language take care about the management.

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 left by a return statement or by an exception).

Note that this only solves one part of the problem which could be 
summarized as resource management. I'm not sure about generated code - 
did someone already post an example where goto might be useful in that 
case or did I miss that one?

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


Re: [PHP-DEV] GOTO operator

2004-07-31 Thread Andi Gutmans
I'm starting to like goto more and more :)
At least it's a simple concept as opposed to using/scoped which make me dizzy.
At 03:24 AM 8/1/2004 +0200, 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 ---
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 think we don't
need goto. i say that we alloc() stuff quite often, but it may be
objects,
resources, what have you instead of chunks.
It's interesting that there is the desire for a low-level construct such
as goto in order to implement scoped deallocation/deconstruction. I
suppose something like C#' using() statement might help you in this
case, although suggesting it will surely lead to another discussion ;)
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 ;)
Of course, what makes you think C#'s using() is restricted to deallocation?
 what you are suggesting
is similar to the hack i'm using now and referred to in an earlier mail, ie
registering thingers to be 'undone'. while useful for certain things, it's
too verbose for the majority of situations When Done Here(tm).
Actually what I was throwing into the discussion is IMO often the cleaner 
solution. You encapsulate _both_ construction and destruction logic into 
the same object, and as a client you just use the using() statement in 
order to have the language take care about the management.

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 left by a return statement or by an exception).

Note that this only solves one part of the problem which could be 
summarized as resource management. I'm not sure about generated code - 
did someone already post an example where goto might be useful in that 
case or did I miss that one?

Cheers,
Michael
paul
paul
--
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


Re: [PHP-DEV] GOTO operator

2004-07-31 Thread Michael Walter
Andi Gutmans wrote:
I'm starting to like goto more and more :)
Good good :)
At least it's a simple concept as opposed to using/scoped which make me 
dizzy.
Hehe, I think scoped could be pretty useful, though.
Cheers,
Michael
At 03:24 AM 8/1/2004 +0200, 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 ---
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 think we 
don't
need goto. i say that we alloc() stuff quite often, but it may be
objects,
resources, what have you instead of chunks.

It's interesting that there is the desire for a low-level construct 
such
as goto in order to implement scoped deallocation/deconstruction. I
suppose something like C#' using() statement might help you in this
case, although suggesting it will surely lead to another discussion ;)

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 ;)
Of course, what makes you think C#'s using() is restricted to 
deallocation?

 what you are suggesting
is similar to the hack i'm using now and referred to in an earlier 
mail, ie
registering thingers to be 'undone'. while useful for certain things, 
it's
too verbose for the majority of situations When Done Here(tm).
Actually what I was throwing into the discussion is IMO often the 
cleaner solution. You encapsulate _both_ construction and destruction 
logic into the same object, and as a client you just use the using() 
statement in order to have the language take care about the management.

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 left by a return statement or by an exception).

Note that this only solves one part of the problem which could be 
summarized as resource management. I'm not sure about generated code 
- did someone already post an example where goto might be useful in 
that case or did I miss that one?

Cheers,
Michael
paul
paul

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


Re: [PHP-DEV] GOTO operator

2004-07-31 Thread Andi Gutmans
Well in general if you have an object and leave the function which 
instantiated it, it'll be destroyed (unless you hold a reference to it from 
some global, in which case you probably don't want it to be destroyed). I 
don't think it has to be more fine-grained than that.

At 05:50 AM 8/1/2004 +0200, Michael Walter wrote:
Andi Gutmans wrote:
I'm starting to like goto more and more :)
Good good :)
At least it's a simple concept as opposed to using/scoped which make me 
dizzy.
Hehe, I think scoped could be pretty useful, though.
Cheers,
Michael
At 03:24 AM 8/1/2004 +0200, 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 ---
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 think we don't
need goto. i say that we alloc() stuff quite often, but it may be
objects,
resources, what have you instead of chunks.

It's interesting that there is the desire for a low-level construct such
as goto in order to implement scoped deallocation/deconstruction. I
suppose something like C#' using() statement might help you in this
case, although suggesting it will surely lead to another discussion ;)

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 ;)
Of course, what makes you think C#'s using() is restricted to deallocation?
 what you are suggesting
is similar to the hack i'm using now and referred to in an earlier mail, ie
registering thingers to be 'undone'. while useful for certain things, it's
too verbose for the majority of situations When Done Here(tm).
Actually what I was throwing into the discussion is IMO often the 
cleaner solution. You encapsulate _both_ construction and destruction 
logic into the same object, and as a client you just use the using() 
statement in order to have the language take care about the management.

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 left by a return statement or by an exception).

Note that this only solves one part of the problem which could be 
summarized as resource management. I'm not sure about generated code - 
did someone already post an example where goto might be useful in that 
case or did I miss that one?

Cheers,
Michael
paul
paul

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