RE: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP

2008-06-18 Thread Andi Gutmans
See below: > -Original Message- > From: Christian Seiler [mailto:[EMAIL PROTECTED] > Sent: Wednesday, June 18, 2008 1:14 PM > To: php-dev List > Subject: Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP > > Frankly, I don't really see a problem with using references. It fi

Re: [PHP-DEV] [PATCH] make it possible to skip very slow tests

2008-06-18 Thread Christopher Jones
Steph Fox wrote: Hi again, I'm using this locally because two of our tests take over 10 minutes each to run on my laptop, and I run the relevant bits of test suite every time I make a change. All it does is adds another option, -x, to run-tests.php. This sets an environmental variable whi

Re: [PHP-DEV] deprecation status of $str{42} versus $str[42]

2008-06-18 Thread Andrei Zmievski
Yes, and we can have TextIterator work on binary strings as well (perhaps by adding TextIterator::BYTE constant). -Andrei Edward Z. Yang wrote: Andrei Zmievski wrote: Maybe TextIterator can be backported from HEAD, because it allows for just that. foreach (new TextIterator($str) as $c) { .

Re: [PHP-DEV] [RFC] Strict type hints (parameter and return value)

2008-06-18 Thread Edward Z. Yang
Fabrice VIGNALS wrote: > In mathematic, equal meen the same value AND the same nature. > The follow fact could be frustrating : Usually, context is good enough to disambiguate between the cases. The most prevalent convention in programming languages is = is assignment, and == is comparison (PHP ad

Re: [PHP-DEV] deprecation status of $str{42} versus $str[42]

2008-06-18 Thread Edward Z. Yang
Andrei Zmievski wrote: > Maybe TextIterator can be backported from HEAD, because it allows for > just that. > > foreach (new TextIterator($str) as $c) { > ... > } IIRC, TextIterator is specifically designed for Unicode, letting you iterate over codepoints, combining sequences, characters, words

Re: [PHP-DEV] deprecation status of $str{42} versus $str[42]

2008-06-18 Thread Stanislav Malyshev
Hi! Maybe TextIterator can be backported from HEAD, because it allows for just that. foreach (new TextIterator($str) as $c) { ... } That'd be a nice addition to intl extension, too - if we implement all functionality. Any volonteers? :) Problem there would be that it would be somewhat slo

Re: [PHP-DEV] deprecation status of $str{42} versus $str[42]

2008-06-18 Thread Andrei Zmievski
Maybe TextIterator can be backported from HEAD, because it allows for just that. foreach (new TextIterator($str) as $c) { ... } Arvids Godjuks wrote: 2008/6/16 Edward Z. Yang <[EMAIL PROTECTED]>: PHP userland code may not treat strings as first class arrays, but that's certainly how they a

Re: [PHP-DEV] [RFC] Strict type hints (parameter and return value)

2008-06-18 Thread Fabrice VIGNALS
In mathematic, equal meen the same value AND the same nature. The follow fact could be frustrating : Code : Output : you must understand than 2 = 2 - Original Message - From: "Stanislav Malyshev" <[EMAIL PROTECTED]> To: "Chris Stockton" <[EMAIL PROTECTED]> Cc: Sent: Monday, June 16

Re: [PHP-DEV] [PATCH] make it possible to skip very slow tests

2008-06-18 Thread Travis Swicegood
Hey Steph; On Jun 18, 2008, at 3:37 PM, Steph Fox wrote: I'm using this locally because two of our tests take over 10 minutes each to run on my laptop, and I run the relevant bits of test suite every time I make a change. All it does is adds another option, -x, to run-tests.php. This sets

Re: [PHP-DEV] [PATCH] make it possible to skip very slow tests

2008-06-18 Thread Stanislav Malyshev
Hi! +$environment['EXEMPT_SLOW_TESTS'] = 1; Maybe "SKIP_SLOW_TESTS"? If it's checked in skip section... :) Otherwise - good idea! -- Stanislav Malyshev, Zend Software Architect [EMAIL PROTECTED] http://www.zend.com/ (408)253-8829 MSN: [EMAIL PROTECTED] -- PHP Internals

[PHP-DEV] [PATCH] make it possible to skip very slow tests

2008-06-18 Thread Steph Fox
Hi again, I'm using this locally because two of our tests take over 10 minutes each to run on my laptop, and I run the relevant bits of test suite every time I make a change. All it does is adds another option, -x, to run-tests.php. This sets an environmental variable which can then be check

[PHP-DEV] [PATCH] unix path separators in spl

2008-06-18 Thread Steph Fox
Hi all, In Phar we have an internal Windows-only function named phar_unixify_path_separators(), which is needed because Phar is intended to be used with web apps. Phar inherits from SPL, which currently uses the system-specific DEFAULT_SLASH when returning directory paths. This isn't actuall

Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP

2008-06-18 Thread Christian Seiler
Hi Andi, Hi Stanislav, - You mention "global" and "static" as examples of how we do things today. They are actually not good examples because the binding by reference which they do has been a real pain over the years. This is why we introduced the $GLOBALS[] array so that you could also assign b

Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP

2008-06-18 Thread Alexey Zakhlestin
On 6/18/08, Stanislav Malyshev <[EMAIL PROTECTED]> wrote: > Which brings me to another point - how bad would it be if closure's > lifetime would be limited to parent's lifetime? Of course, this would limit > some tricks, but would allow some other - like this direct access to > parent's scope. t

Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP

2008-06-18 Thread Stanislav Malyshev
Hi! by reference ($GLOBALS["foo"] =& $var). Now that I think of this example I'd actually prefer to see $LEXICALS[] or something similar The problem here might be that if we do something like $LEX[$foo] in runtime, we don't know which parts of parent's scope we need to preserve. While I like

RE: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP

2008-06-18 Thread Andi Gutmans
Hi Christian, Thanks for the clarifications. This helped a lot and makes me feel very confident about this implementation. I think this is a very strong proposal. A few additional things I thought about while taking a closer look: - You mention "global" and "static" as examples of how we do thin

Re: [PHP-DEV] [PATCH] getting current request's response code

2008-06-18 Thread Stanislav Malyshev
Hi! Any interest in the attached patch? It introduces a "headers_response_code()" function which returns I see no problem with it. Just don't forget to add docs and test if you add it :) -- Stanislav Malyshev, Zend Software Architect [EMAIL PROTECTED] http://www.zend.com/ (408)253-8829 M

Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP

2008-06-18 Thread Stanislav Malyshev
Hi! This lookup happens at the time the closure is first declared, and the value is stored for later use by the closure; the calling scope doesn't This would work for $var, but what about $$var and various other ways of indirect variable access? -- Stanislav Malyshev, Zend Software Architec

Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP

2008-06-18 Thread Christian Seiler
Hi, [I'm going to collect here a bit:] Stanislav Malyshev wrote: lexical in the proposal binds to creator's scope, not caller's scope, as I understood. Anyway, binding to caller's immediate scope doesn't seem that useful since you could just pass it as a parameter when calling. Correct and I

Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP

2008-06-18 Thread Gwynne Raskind
On Jun 18, 2008, at 11:01 AM, Stanislav Malyshev wrote: The Lua interpreter handles this by resolving variable references as they're made; "someVariable1" is looked up in the closure's scope and not found, so the interpreter steps out one scope and looks for it You may get into a problem her

Re: [PHP-DEV] FastArray, great addition

2008-06-18 Thread Etienne Kneuss
Hello, On Wed, Jun 18, 2008 at 4:47 PM, Antony Dovgal <[EMAIL PROTECTED]> wrote: > On 18.06.2008 16:40, Alexey Zakhlestin wrote: >> >> On 6/18/08, Antony Dovgal <[EMAIL PROTECTED]> wrote: >> >>> Though I'd like to be able to cast these arrays to PHP's arrays and we >>> need >>> to implement get_p

Re: [PHP-DEV] FastArray, great addition

2008-06-18 Thread Alexey Zakhlestin
On 6/18/08, Antony Dovgal <[EMAIL PROTECTED]> wrote: > > 2-way conversion would be perfect ;) > > > > There is no way to cast an array to an object of certain class, but it > should not be a problem to add a function to convert array to fastarray. > > Want to make a patch yourself? > Should be

Re: [PHP-DEV] FastArray, great addition

2008-06-18 Thread Antony Dovgal
On 18.06.2008 16:40, Alexey Zakhlestin wrote: On 6/18/08, Antony Dovgal <[EMAIL PROTECTED]> wrote: Though I'd like to be able to cast these arrays to PHP's arrays and we need to implement get_properties() handler for that. If there are no objections, I'll commit my patch when I get back home

Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP

2008-06-18 Thread Chris Stockton
Hello, I am curious if is_callable will be able to detect these? Or do we need a is_lamba, or is_function or something. You may have mentioned it but reading through I did not notice. I am only curious how to know when someone passed me one of these. Maybe a type hint would be nice too but that is

Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP

2008-06-18 Thread Stanislav Malyshev
Hi! First: My patch is quite non-intrusive, it only adds things in a few places (new opcode, a few checks). If you only look at the non-generated I think it falls into "famous last words" category. While I did not have time yet to look into the patch in the detail, I have hard time to believe

Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP

2008-06-18 Thread Stanislav Malyshev
Hi! The Lua interpreter handles this by resolving variable references as they're made; "someVariable1" is looked up in the closure's scope and not found, so the interpreter steps out one scope and looks for it You may get into a problem here - creator's scope may not exist when you execute

Re: [PHP-DEV] FastArray, great addition

2008-06-18 Thread Alexey Zakhlestin
On 6/18/08, Antony Dovgal <[EMAIL PROTECTED]> wrote: > Though I'd like to be able to cast these arrays to PHP's arrays and we need > to implement get_properties() handler for that. > If there are no objections, I'll commit my patch when I get back home (30th > of June). 2-way conversion would b

Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP

2008-06-18 Thread Christian Seiler
Hi! 1) I am not sure that the current semantics of the "lexical" keyword is great in all cases. Is the reason why you don't allow by-value binding so that we don't have to manage more than one lambda instance per declaration? First of all: global and static are also used to create references t

Re: [PHP-DEV] Selectable error messages

2008-06-18 Thread Christian Schmidt
Lester Caine wrote: Short of switching display_errors on and off all the time, how do other people handle this irritation? I don't have experiences with E_DEPRECATED, but for E_STRICT we use a custom error handler to surpress strict errors in external libraries. Not all E_STRICT errors can be

Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP

2008-06-18 Thread Christian Seiler
Hi! - I am a little confused about the OOP interaction. How does a function become a public method of the class? To clarify: the "public method" ist just the internal representation of the lambda function and has *nothing* to do with the semantics of calling the lambda itself. The "method" onl

Re: [PHP-DEV] FastArray, great addition

2008-06-18 Thread Antony Dovgal
On 16.06.2008 14:28, Pierre Joye wrote: My only wish is to actually respect the informal decision we took a while back, to do not use "fast", "improved", "better" or similar wording in function or extension names. What's about naming it CArray or something similar? To reflect what it is, it is no

Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP

2008-06-18 Thread Richard Quadling
2008/6/18 Gwynne Raskind <[EMAIL PROTECTED]>: > On Jun 18, 2008, at 2:36 AM, Alexey Zakhlestin wrote: > >> 1) I am not sure that the current semantics of the "lexical" keyword is >>> great in all cases. Is the reason why you don't allow by-value binding so >>> that we don't have to manage more tha

Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP

2008-06-18 Thread Gwynne Raskind
On Jun 18, 2008, at 2:36 AM, Alexey Zakhlestin wrote: 1) I am not sure that the current semantics of the "lexical" keyword is great in all cases. Is the reason why you don't allow by- value binding so that we don't have to manage more than one lambda instance per declaration? by-reference bi

Re: [PHP-DEV] Selectable error messages

2008-06-18 Thread Pierre Joye
hi Lester, On Wed, Jun 18, 2008 at 9:14 AM, Lester Caine <[EMAIL PROTECTED]> wrote: > Short of switching display_errors on and off all the time, how do other > people handle this irritation? I could repair phpDocumentor in this case and > ignore BC as I will not be running THAT on older version o

[PHP-DEV] Selectable error messages

2008-06-18 Thread Lester Caine
OK - I've got PHP5.3.0-dev up at the moment in order to test the Firebird stuff, so display_errors is on. I need it on anyway while testing code. The 'problem' I am having is that of cause none of the other PHP stuff I'm using is currently not compatible with PHP5.3 so generates a lot of deprec