Re: [PHP-DEV] Regarding PHP6, string/array APIs

2012-07-19 Thread Ralf Lang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 - -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Am 20.07.2012 02:09, schrieb Stas Malyshev: > Hi! > >> 2. It would be really useful to have 2 versions of each >> function: one which mutates the variable and one which returns >> the new variable. >>

Re: [PHP-DEV] Any chance to fix php-trunk for windows?

2012-07-19 Thread Marian Kostadinov
Hello Anatoly, I've just downloaded 5.4.5 and initially it seemed to be working. But after I clicked here and there and ... it started to crash again. I suspect that it is all about accumulating memory errors because initially it used to work but then it stopped. Also, in CLI mode, it is more diffi

Re: [PHP-DEV] zend_parse_parameters() improvements

2012-07-19 Thread Stas Malyshev
Hi! > And just to clear, I agree with Sara that ! (both for l/d/b and the > pointer types) should not be redefined to "parameter was passed". But it's > my understanding that that's not what you're planning. I didn't have yet a good generic way to handle l/d/b with 'default' - in many cases f

Re: [PHP-DEV] Pseudo-objects (methods on arrays, strings, etc.)

2012-07-19 Thread David Muir
On 20/07/12 09:38, Andrew Faulds wrote: > I'm curious, how do I make my objects have scalar passing semantics, then? > On Jul 20, 2012 12:35 AM, "Sara Golemon" wrote: > How about this? class String { protected $string=''; public function __construct($string){ $this->string =

Re: [PHP-DEV] Regarding PHP6, string/array APIs

2012-07-19 Thread Anthony Ferrara
Hey all, So I've been thinking about this for a while. Here's what I've come up with: 1. We want to maintain loose typing, so implementing a different API on string than on int types would be bad. 2. We want to retain backwards compatibility to some extent with the legacy API. 3. We want the ab

Re: [PHP-DEV] zend_parse_parameters() improvements

2012-07-19 Thread Gustavo Lopes
Em Fri, 20 Jul 2012 02:07:31 +0200, Stas Malyshev escreveu: Default parameters and unpassed parameters enter the scene because it's idiomatic to pass NULL to have the same effect as not passing that parameter. Actually, as it never worked with int parameters, I'd not really call it idiomati

Re: [PHP-DEV] Regarding PHP6, string/array APIs

2012-07-19 Thread Stas Malyshev
Hi! > 2. It would be really useful to have 2 versions of each function: one > which mutates the variable and one which returns the new variable. > > Example: > > 'source', $src == 'SoUrCe' $result = lower($srd); // $result == > true, $src = 'source' ?> > I'm not sure I understand why. What

Re: [PHP-DEV] zend_parse_parameters() improvements

2012-07-19 Thread Stas Malyshev
Hi! > Default parameters and unpassed parameters enter the scene because it's > idiomatic to pass NULL to have the same effect as not passing that > parameter. Actually, as it never worked with int parameters, I'd not really call it idiomatic just yet. I was just thinking - since we have bas

Re: [PHP-DEV] zend_parse_parameters() improvements

2012-07-19 Thread Gustavo Lopes
Em Fri, 20 Jul 2012 00:20:49 +0200, Sara Golemon escreveu: Okay, well... the main pieces of feedback I'd give on it then is to not change the behavior of the '!' modifier. That's bad BC. Rather, introduce a new modifier for checking if a parameter was passed. Secondly, make these two se

Re: [PHP-DEV] Pseudo-objects (methods on arrays, strings, etc.)

2012-07-19 Thread Andrew Faulds
I'm curious, how do I make my objects have scalar passing semantics, then? On Jul 20, 2012 12:35 AM, "Sara Golemon" wrote: > > > On Thu, Jul 19, 2012 at 2:42 PM, Andrew Faulds wrote: > >> I never said treat them as objects. I said give them methods. Not the >> same thing. >> > Fair enough, noone

Re: [PHP-DEV] Pseudo-objects (methods on arrays, strings, etc.)

2012-07-19 Thread Sara Golemon
On Thu, Jul 19, 2012 at 2:42 PM, Andrew Faulds wrote: > I never said treat them as objects. I said give them methods. Not the same > thing. > Fair enough, noone is talking about giving them properties or formal class definitions. > And what do you mean by "technical debt"? > I mean that we'll nev

Re: [PHP-DEV] zend_parse_parameters() improvements

2012-07-19 Thread Nikita Popov
On Fri, Jul 20, 2012 at 12:20 AM, Sara Golemon wrote: > Okay, well... the main pieces of feedback I'd give on it then is to not > change the behavior of the '!' modifier. That's bad BC. The behavior for pointer-params isn't changed. Only non-pointer params will then accept the additional is_null

Re: [PHP-DEV] zend_parse_parameters() improvements

2012-07-19 Thread Sara Golemon
Okay, well... the main pieces of feedback I'd give on it then is to not change the behavior of the '!' modifier. That's bad BC. Rather, introduce a new modifier for checking if a parameter was passed. Secondly, make these two separate patches as the new modifier is a separate feature from the si

[PHP-DEV] PHP 5.4.5 and PHP 5.3.15 Released!

2012-07-19 Thread David Soria Parra
Hello! The PHP Development Team announces the immediate availability of PHP 5.4.5 and PHP 5.3.15. The releases fixes a security issue in the stream implementation and over 30 bugs. All users are adviced to update to PHP 5.3.15 or PHP 5.4.5! PHP 5.4.5: Release Announcement: http://www.php.ne

Re: [PHP-DEV] How to track down an APC bug

2012-07-19 Thread Andrew Faulds
Ah, thanks. My mobile internet is horribly slow: But somehow Gmail works pretty fast (constant connection??). Hence not Googling first. On Jul 19, 2012 10:44 PM, "Kalle Sommer Nielsen" wrote: > 2012/7/19 Andrew Faulds : > > Forgive my ignorance, what is APC? > > Alternative PHP Cache > > http://p

Re: [PHP-DEV] How to track down an APC bug

2012-07-19 Thread Kalle Sommer Nielsen
2012/7/19 Andrew Faulds : > Forgive my ignorance, what is APC? Alternative PHP Cache http://pecl.php.net/apc http://php.net/apc -- regards, Kalle Sommer Nielsen ka...@php.net -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Pseudo-objects (methods on arrays, strings, etc.)

2012-07-19 Thread Andrew Faulds
I never said treat them as objects. I said give them methods. Not the same thing. And what do you mean by "technical debt"? On Jul 19, 2012 9:52 PM, "Sara Golemon" wrote: > > > On Mon, Jul 16, 2012 at 4:27 PM, Andrew Faulds wrote: > >> I think PHP could benefit from making arrays, strings, integ

Re: [PHP-DEV] How to track down an APC bug

2012-07-19 Thread Andrew Faulds
Forgive my ignorance, what is APC? On Jul 19, 2012 7:15 PM, "Rasmus Lerdorf" wrote: > The goal of this message is to encourage and motivate a few people to > give me a hand with tracking down APC bugs. There are still a few > outstanding bugs that is slowing PHP 5.4 adoption and it would be reall

Re: [PHP-DEV] zend_parse_parameters() improvements

2012-07-19 Thread Stas Malyshev
Hi! > This solves two problems: > > a) Integer parameters cannot currently be skipped using NULL. This > issue comes up every now and then. E.g. see > https://github.com/php/php-src/pull/133. Again, I think param skipping RFC addresses this better, but having some way to see if param was supplie

Re: [PHP-DEV] zend_parse_parameters() improvements

2012-07-19 Thread Nikita Popov
On Thu, Jul 19, 2012 at 11:23 PM, Sara Golemon wrote: > Then I'm not sure what problem you're trying to solve either. :/ This solves two problems: a) Integer parameters cannot currently be skipped using NULL. This issue comes up every now and then. E.g. see https://github.com/php/php-src/pull/13

Re: [PHP-DEV] zend_parse_parameters() improvements

2012-07-19 Thread Sara Golemon
Then I'm not sure what problem you're trying to solve either. :/ On Thu, Jul 19, 2012 at 12:08 PM, Gustavo Lopes wrote: > Em Thu, 19 Jul 2012 20:36:45 +0200, Sara Golemon > escreveu: > > > For this type of situation, you could equally go with something like: >> >> zval *val; >> if (zend_parse_p

Re: [PHP-DEV] Pseudo-objects (methods on arrays, strings, etc.)

2012-07-19 Thread Sara Golemon
On Mon, Jul 16, 2012 at 4:27 PM, Andrew Faulds wrote: > I think PHP could benefit from making arrays, strings, integers, > floats, and possibly booleans, into "pseudo-objects". By this I mean > that they are not really objects (they are still primitive types and > keep their passing semantics), bu

Re: [PHP-DEV] A new idea on PHP6.

2012-07-19 Thread D. Dante Lorenso
On 7/19/12 1:17 AM, Ronald Chmara wrote: With PHP 6, lets start with a: Pure Object Oriented PHP OMG, did you seriously just recommend POOP? LOL, I'm gonna go die now. -- Dante D. Dante Lorenso da...@lorenso.com 972-333-4139 -- PHP Internals - PHP Runtime Development Mailing List To unsubs

Re: [PHP-DEV] Any chance to fix php-trunk for windows?

2012-07-19 Thread Anatoliy Belsky
Hi Marion, not sure what's not working for you, the test Zend/tests/traits/bug61998.phpt passes for me on windows master. Could you supply a piece of code for that? Regards Anatoliy Am Mi, 18.07.2012, 08:12 schrieb Marian Kostadinov: > Hello Anatoliy, > I've just tried latest and greatest from

Re: [PHP-DEV] Call for voting: [RFC] Allow use T_AS in closure use statement

2012-07-19 Thread Nikita Popov
On Thu, Jul 19, 2012 at 8:17 PM, Sara Golemon wrote: > Did the voting close already? One day seems awfully short. :( Laruence closed the vote because he wanted to add aliasing of arbitrary expressions instead of just variables. Nikita -- PHP Internals - PHP Runtime Development Mailing List To

Re: [PHP-DEV] zend_parse_parameters() improvements

2012-07-19 Thread Gustavo Lopes
Em Thu, 19 Jul 2012 20:36:45 +0200, Sara Golemon escreveu: For this type of situation, you could equally go with something like: zval *val; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "n", &val) == FAILURE) { RETURN_NULL(); } Where the 'n' type looks for a numeric value: IS_LONG

Re: [PHP-DEV] Recommended way to create a zval that serves as a callback in an extension

2012-07-19 Thread Sara Golemon
Same as you would in PHP code. Make an IS_STRING pointing at a global function, or IS_ARRAY pointing at a class method, or an IS_OBJECT supporting __invoke(). If you're asking how you can call a C function directly via this callback: You can't. You can can, however, make an internal method to us

Re: [PHP-DEV] zend_parse_parameters() improvements

2012-07-19 Thread Sara Golemon
For this type of situation, you could equally go with something like: zval *val; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "n", &val) == FAILURE) { RETURN_NULL(); } Where the 'n' type looks for a numeric value: IS_LONG/IS_DOUBLE kept as is, IS_STRING/IS_OBJECT (with toString() behavior

Re: [PHP-DEV] A new idea on PHP6.

2012-07-19 Thread Kris Craig
On Thu, Jul 19, 2012 at 11:16 AM, Ronald Chmara wrote: > On Thu, Jul 19, 2012 at 11:09 AM, Kris Craig wrote: > > I get that the first two acronyms are POOP and SHIT; however, the third > one, > > HARAH, is throwing me off. Is that a fecal reference in some other > language > > or something? > >

Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Sara Golemon
For all the reasons already stated, most explicitly because it make the code ugly as sin, my vote is somewhere between "No", and "Hell No." -1 on bracketless try/catch On Thu, Jul 19, 2012 at 2:44 AM, Ivan Enderlin @ Hoa < ivan.ender...@hoa-project.net> wrote: > Hi internals, > > As you certain

Re: [PHP-DEV] Call for voting: [RFC] Allow use T_AS in closure use statement

2012-07-19 Thread Sara Golemon
Did the voting close already? One day seems awfully short. :( On Wed, Jul 18, 2012 at 7:54 AM, Laruence wrote: > Hi: > Call for voting for "Allow use T_AS in closure use statement", > https://wiki.php.net/rfc/useas#voting > > any comment will be appreciated. > > thanks > > -- > Laruence

Re: [PHP-DEV] A new idea on PHP6.

2012-07-19 Thread Ronald Chmara
On Thu, Jul 19, 2012 at 11:09 AM, Kris Craig wrote: > I get that the first two acronyms are POOP and SHIT; however, the third one, > HARAH, is throwing me off. Is that a fecal reference in some other language > or something? http://www.youswear.com/index.asp?language=Hebrew I thought about maki

[PHP-DEV] How to track down an APC bug

2012-07-19 Thread Rasmus Lerdorf
The goal of this message is to encourage and motivate a few people to give me a hand with tracking down APC bugs. There are still a few outstanding bugs that is slowing PHP 5.4 adoption and it would be really nice to plow through these instead of wasting cycles on some of the other discussions goin

Re: [PHP-DEV] A new idea on PHP6.

2012-07-19 Thread Kris Craig
On Thu, Jul 19, 2012 at 4:40 AM, Andrew Faulds wrote: > Our syntax is very, very confusing for newbies. Also, procedural and OOP > programming is unnatural and unintuitive. We should use the natural LISP > braces syntax and make PHP functional, so it is much easier to write, e.g.: > > ((decl (main

Re: [PHP-DEV] PHP Wiki problem

2012-07-19 Thread Kris Craig
On Thu, Jul 19, 2012 at 7:35 AM, Lonny Kapelushnik wrote: > Hi, > > I found a problem in the PHP WIki. On IRC it was suggested that I open a > bug report (#62611) and email internals. > > https://wiki.php.net/vcs/gitworkflow has wrong directions for 'Workflow > for > external contributors'. > > A

Re: [PHP-DEV] Pseudo-objects (methods on arrays, strings, etc.)

2012-07-19 Thread Stas Malyshev
Hi! > So we should better begin to see where are the technical bottlenecks > and figure out a way to solve them instead of arguing about whether we > should do it or not. Because we will have to do it, whether we like it > or not. No, that's exactly WRONG way to do things. We should first know if

Re: [PHP-DEV] Pseudo-objects (methods on arrays, strings, etc.)

2012-07-19 Thread Andrew Faulds
wat The pseudo- prefix means something. These scalar and array vars are unchanged. The methods are implemented via an engine shortcut, not by making them objects. On Jul 19, 2012 6:24 PM, "Lester Caine" wrote: > Pierre Joye wrote: >> >> should still work. All the string API metho

Re: [PHP-DEV] Pseudo-objects (methods on arrays, strings, etc.)

2012-07-19 Thread Lester Caine
Pierre Joye wrote: should still work. All the string API methods need to be available on >every pseudo-object regardless of the type. So I don't see any "cleanup" >here either. I do, and again this is purely a theoretical discussion

Re: [PHP-DEV] Pseudo-objects (methods on arrays, strings, etc.)

2012-07-19 Thread Andrew Faulds
PHP is all about backwards compatibility. We only break things that need to be broken. The legacy str*/str_*/string_*/array_* functions will still work. On Jul 19, 2012 5:36 PM, "Lester Caine" wrote: > Pierre Joye wrote: > >> should still work. All the string API methods need to be available on

Re: [PHP-DEV] Pseudo-objects (methods on arrays, strings, etc.)

2012-07-19 Thread Lester Caine
Pierre Joye wrote: should still work. All the string API methods need to be available on >every pseudo-object regardless of the type. So I don't see any "cleanup" >here either. I do, and again this is purely a theoretical discussion right now. However I find disturbing the resistance to such a p

Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Andrew Faulds
HTML5 allow omitting head, body, html (they had no fundamental differences in parsing IRL), and also quotes and some end tags. Makes for much, much nicer HTML, e.g.: hello hi item 1 item 2 ...that's off-topic though. I don't think we should have more tolerance of omitted braces in PH

Re: [PHP-DEV] Pseudo-objects (methods on arrays, strings, etc.)

2012-07-19 Thread Andrew Faulds
We can have more consistent naming, at least. I like this idea even more now, it means we could have a set of universal operations: $bool->negate(); // true -> false $num->negate(); // 7 -> -7 $numericString->negate(); // "123" -> -123 $float->negate(); // 3.141592 -> -3.141592 $customVectorType-

Re: [PHP-DEV] Pseudo-objects (methods on arrays, strings, etc.)

2012-07-19 Thread Pierre Joye
On Thu, Jul 19, 2012 at 5:49 PM, Rasmus Lerdorf wrote: > should still work. All the string API methods need to be available on > every pseudo-object regardless of the type. So I don't see any "cleanup" > here either. I do, and again this is purely a theoretical discussion right now. However I fi

Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Larry Garfield
There is no such thing as an optional closing tag or brace. There's only lazy and sloppy coders, and parsers that encourage them. --Larry Garfield On 7/19/12 10:52 AM, Andrew Faulds wrote: Always close , but never close :) On Jul 19, 2012 4:44 PM, "Larry Garfield" wrote: On 7/19/12 5:11 A

Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Andrew Faulds
Always close , but never close :) On Jul 19, 2012 4:44 PM, "Larry Garfield" wrote: > On 7/19/12 5:11 AM, Peter Beverloo wrote: > > I have seen this problem happen, people losing time trying to figure out >>> what is wrong only to find >>> its a missing bracket. >>> As Paul said, this is bug-pro

Re: [PHP-DEV] Pseudo-objects (methods on arrays, strings, etc.)

2012-07-19 Thread Rasmus Lerdorf
On 07/19/2012 12:25 AM, Pierre Joye wrote: > hi Rasmus, > > On Wed, Jul 18, 2012 at 8:49 PM, Rasmus Lerdorf wrote: > >> This makes no sense to me either. How does it let us clean the APIs? Can >> you give an example? I have one: >> >> $a = -5; >> $b = "-5"; >> >> echo $a->abs(); // Outputs 5 >>

Re: [PHP-DEV] 6.0 And Moving Forward

2012-07-19 Thread Andrew Faulds
I like this idea, but I think it should be visible by default, and hidden by using a special namespace import like "use NOLEGACY" or something. On Jul 19, 2012 3:21 PM, "Michael Morris" wrote: > I want to clarify what I mean when I state that the existing API > should move to a legacy namespace.

Re: [PHP-DEV] RFC karma request

2012-07-19 Thread Hannes Magnusson
On Wed, Jul 18, 2012 at 11:43 PM, Galen Wright-Watson wrote: > I'd like to see some version of the null-coalescing ternary operator > (recently brought up in a thread started by Rafael Dohms) make it into PHP. > To help it along, may I have RFC karma so I can draft a proposal? My PHP > wiki accoun

Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Larry Garfield
On 7/19/12 5:11 AM, Peter Beverloo wrote: I have seen this problem happen, people losing time trying to figure out what is wrong only to find its a missing bracket. As Paul said, this is bug-prone. Other bracket-less blocks allow authors to shoot themselves in the foot equally so, yet PHP sup

Re: [PHP-DEV] Call for voting: [RFC] Allow use T_AS in closure use statement

2012-07-19 Thread Ivan Enderlin @ Hoa
On 18/07/12 17:19, Leigh wrote: I missed the discussion on this one, the RFC examples are very simple. Does it support aliasing array indices? I have missed the discussion two. I can't vote but I don't feel confortable with this new notation. Wouldn't be better to make the “=” operator availab

[PHP-DEV] PHP Wiki problem

2012-07-19 Thread Lonny Kapelushnik
Hi, I found a problem in the PHP WIki. On IRC it was suggested that I open a bug report (#62611) and email internals. https://wiki.php.net/vcs/gitworkflow has wrong directions for 'Workflow for external contributors'. After `git remote...` you need to call `git fetch upstream` and the rebase nee

Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Cyberspice
Probably not so much in PHP but I've had some real doozers in my time due this. For example in C... if (somethingsFailed) DEBUG_MACRO("Something failed!"); var = 1; And then someone un-defines DEBUG_MACRO. Fun then ensues. Melanie On 19 Jul 2012, at 11:03, Charlie Somerville wrote:

Re: [PHP-DEV] 6.0 And Moving Forward

2012-07-19 Thread Michael Morris
I want to clarify what I mean when I state that the existing API should move to a legacy namespace. First, the only reason to do this is if you want to change the behavior of functions to make them consistent. For example, Is it haystack, needle or needle, haystack? Second, how namespaces resolve

Re: [PHP-DEV] Call for voting: [RFC] Allow use T_AS in closure use statement

2012-07-19 Thread Anthony Ferrara
Laruence, On Wed, Jul 18, 2012 at 9:53 PM, Laruence wrote: > Hi: > I saw you two vote against for this RFC. > > could you explain why? then maybe I can improve it. > > thanks The reason that I voted against it is simple. It's sugar to make it harder to understand what the code is doin

Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Lester Caine
Sebastian Krebs wrote: Of course it's a matter of code style [1], but one can write the ugliest code with every syntax. This argument about "bug-prone" often confuses me, because I for myself never had such a problem. I also never knew someone, who had a problem with bracket-less blocks (but must

Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Sebastian Krebs
2012/7/19 Rafael Dohms > On Thu, Jul 19, 2012 at 12:03 PM, Charlie Somerville < > char...@charliesomerville.com> wrote: > > > This has code readability problem written all over it. When maintaining > it > > also has problems, like with the bracket-less if's. > > You would need to add brackets if

Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread jevon
This reminds me of $var = something or die(); So if you do follow with braceless-try, I would have try something() catch($e) do_something_with($e); Or (a bit simpler, but assumes we have a new pseudovariable $e), try something() or do_something_with($e) I don't like the form with a semi

Re: [PHP-DEV] 6.0 And Moving Forward

2012-07-19 Thread Andrew Faulds
+1 There's a reason that web browser APIs have so much cruft (user-agent string, yuck), and there's a reason for ECMAScript 5's "use strict" instead of "use legacy". Old code should work without changing it. Otherwise a lot of things break which take a lot of time to fix, and even worse, devs can

Re: [PHP-DEV] 6.0 And Moving Forward

2012-07-19 Thread Lester Caine
Daniel Macedo wrote: What I was stating is that: IF you want to keep the old way of doing things around instead of removing them, it should be "change settings/tag/whatever so it work as the old way" and not "change it so it works the new way", that was my only point. Obviously you don't suppor

Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Lester Caine
Peter Beverloo wrote: Other bracket-less blocks allow authors to shoot themselves in the foot equally so, yet PHP supports these as well. The actual problem here is an inconsistency in the parser, which I'd consider to be a bug. Having been caught out too many times now when adding an extra par

Re: [PHP-DEV] Pseudo-objects (methods on arrays, strings, etc.)

2012-07-19 Thread Andrew Faulds
Right, because I've never got them the wrong way round, that is completely logical, and this syntax makes it much harder. On Jul 19, 2012 1:17 AM, "Rasmus Lerdorf" wrote: > On 07/18/2012 05:10 PM, David Muir wrote: > > On 19/07/12 04:49, Rasmus Lerdorf wrote: > >> On 07/18/2012 01:02 AM, Pierre J

Re: [PHP-DEV] Regarding PHP6, string/array APIs

2012-07-19 Thread Andrew Faulds
One consideration: Should be a general array/string/int/float/bool API. PHP is weakly typed: therefore, say, reverse() would reverse a string OR an array. negate() would invert a bool, negate an int/float. slice() would slice a section of a string OR an array. max() would find maximum of an array,

Re: [PHP-DEV] A new idea on PHP6.

2012-07-19 Thread Andrew Faulds
Our syntax is very, very confusing for newbies. Also, procedural and OOP programming is unnatural and unintuitive. We should use the natural LISP braces syntax and make PHP functional, so it is much easier to write, e.g.: ((decl (main (echo (add (reverse (array (1 2 3))) (string ('h 'e 'l 'l 'o '\

[PHP-DEV] 回复: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Reeze
Hi, 在 2012年7月19日星期四,下午6:45,Rune Kaagaard 写道: > +1 for the consistency of it. It's surprising that: > > if ($foo) > return $bar; > else > return 42; > > works and: > > try > maybe_dangerous(); > catch(Dynamite $e) > handle_error(); > > There is no condition after `try`, it's really har

Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Rune Kaagaard
+1 for the consistency of it. It's surprising that: if ($foo) return $bar; else return 42; works and: try maybe_dangerous(); catch(Dynamite $e) handle_error(); does not. On Thu, Jul 19, 2012 at 12:11 PM, Peter Beverloo wrote: > On Thu, Jul 19, 2

Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Peter Beverloo
On Thu, Jul 19, 2012 at 11:06 AM, Rafael Dohms wrote: > On Thu, Jul 19, 2012 at 12:03 PM, Charlie Somerville < > char...@charliesomerville.com> wrote: > > > This has code readability problem written all over it. When maintaining > it > > also has problems, like with the bracket-less if's. > > You

Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Rafael Dohms
On Thu, Jul 19, 2012 at 12:03 PM, Charlie Somerville < char...@charliesomerville.com> wrote: > This has code readability problem written all over it. When maintaining it > also has problems, like with the bracket-less if's. > You would need to add brackets if you add an extra line here, as well as

Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Rafael Dohms
On Thu, Jul 19, 2012 at 11:58 AM, Charlie Somerville < char...@charliesomerville.com> wrote: > > On Thursday, 19 July 2012 at 7:49 PM, Paul Dragoonis wrote: > > > Why is your try block only going to contain 1 line, and that's > > throwing an exception?? > > > > try > > throw new Exception('foobar'

Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Charlie Somerville
> This has code readability problem written all over it. When maintaining it > also has problems, like with the bracket-less if's. > You would need to add brackets if you add an extra line here, as well as > you might get unexpected behaviour of you forget to > add brackets in that case. > >

Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Sebastian Krebs
Hi, 2012/7/19 Paul Dragoonis > Why is your try block only going to contain 1 line, and that's > throwing an exception?? > > try > throw new Exception('foobar'); > catch(Exception $e) > > > Braces are a good thing, they give structure and stop people from > mis-reading things and writing bugs, th

Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Paul Dragoonis
On Thu, Jul 19, 2012 at 10:58 AM, Charlie Somerville wrote: > On Thursday, 19 July 2012 at 7:49 PM, Paul Dragoonis wrote: > > Why is your try block only going to contain 1 line, and that's > throwing an exception?? > > try > throw new Exception('foobar'); > catch(Exception $e) > > Because it's a c

Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Rafael Dohms
On Thu, Jul 19, 2012 at 11:44 AM, Ivan Enderlin @ Hoa < ivan.ender...@hoa-project.net> wrote: > Hi internals, > > As you certainly know, brackets defining blocks in PHP are optional if > blocks contain a single instruction. Thus: > > if($condition) { > echo 'foobar'; > } > > is strictly equivalent

Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Charlie Somerville
On Thursday, 19 July 2012 at 7:49 PM, Paul Dragoonis wrote: > Why is your try block only going to contain 1 line, and that's > throwing an exception?? > > try > throw new Exception('foobar'); > catch(Exception $e) > > Because it's a contrived example. He's not trying to write real code, he

Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Alexey Zakhlestin
On 19.07.2012, at 13:49, Paul Dragoonis wrote: > 2) Try with only one line in it to throw an exception doesn't seem > like a realistic situation. It could be something like this: try $object->method(); catch (\Exception $e) return false; and ->method(), obviously, can have quite a long and co

Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Paul Dragoonis
Why is your try block only going to contain 1 line, and that's throwing an exception?? try throw new Exception('foobar'); catch(Exception $e) Braces are a good thing, they give structure and stop people from mis-reading things and writing bugs, the same can be said for the if() situation. 1) Br

[PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Ivan Enderlin @ Hoa
Hi internals, As you certainly know, brackets defining blocks in PHP are optional if blocks contain a single instruction. Thus: if($condition) { echo 'foobar'; } is strictly equivalent to: if($condition) echo 'foobar'; But this syntactic sugar is not applied uniformly to all PHP language c

Re: [PHP-DEV] Integer overflows on float to int casts

2012-07-19 Thread Anatoliy Belsky
Hi Nikita, that's exactly the subject I've tripped over trying to fix (apparently wrong) the issue #62477. The ticket is about LimitIterator accepting only long for start and offset, but being able to accept an Iterator from userland accepting floats for positions. For instance, the snippet like

Re: [PHP-DEV] A new idea on PHP6.

2012-07-19 Thread dukeofgaming
Now that we have Traits, lets bring in Aspects too! http://en.wikipedia.org/wiki/Aspect-oriented_programming Also, PHP is not necessarily evil by allowing non-OO code, but maybe we could do better at the non-OO code side of things by adding prototyped inheritance in a javascript-ish spirit to at l

[PHP-DEV] Regarding PHP6, string/array APIs

2012-07-19 Thread Alexey Zakhlestin
Stas made a good point about need to start with new API, which then can be followed by syntactic sugar. So, we need some ideas to start with: 1. A lot of people told, that it would be a good idea to come with a written standard regarding arguments order. I don't care what it will be, as long as

Re: [PHP-DEV] Pseudo-objects (methods on arrays, strings, etc.)

2012-07-19 Thread Pierre Joye
hi Rasmus, On Wed, Jul 18, 2012 at 8:49 PM, Rasmus Lerdorf wrote: > This makes no sense to me either. How does it let us clean the APIs? Can > you give an example? I have one: > > $a = -5; > $b = "-5"; > > echo $a->abs(); // Outputs 5 > echo $b->abs(); // should still output 5 > > What has bee