[PHP-DEV] Re: internals Digest 18 Apr 2012 20:34:27 -0000 Issue 2671

2012-04-18 Thread Rasmus Schultz
> On 04/10/2012 06:20 PM, Adir Kuhn wrote: > >  "PHP Gotchas, how they came to be, and why we can't simply fix them" > can't or won't? It seems that the requirement for backward compatibility, as with most software, stands in the way of any substantial leaps, and makes it impossible to do away wi

Re: [PHP-DEV] [RFC] skipping optional parameters

2012-04-18 Thread Stas Malyshev
Hi! > Before addressing the points individually, I have to reiterate that > internal functions have no concept of default values. I think this I disagree. Most of them certainly do, for example, look at strpos documentation: int strpos ( string $haystack , mixed $needle [, int $offset = 0 ] ) $

Re: [PHP-DEV] [RFC] skipping optional parameters

2012-04-18 Thread Gustavo Lopes
On Wed, 18 Apr 2012 23:35:37 +0200, Stas Malyshev wrote: Before addressing the points individually, I have to reiterate that internal functions have no concept of default values. I think this proposal or a named arguments proposal is *really* ill-advised without introducing proper default values

Re: [PHP-DEV] [VOTE] Allow non-variable arguments to empty()

2012-04-18 Thread Kris Craig
Ugh I hate to throw a POO into this, but On Wed, Apr 18, 2012 at 4:09 PM, Nikita Popov wrote: > Hey internals :) > > As there doesn't seem to be any further discussion regarding my RFC, > I've opened the vote: > > https://wiki.php.net/rfc/empty_isset_exprs#vote > > Nikita > > -- > PHP Interna

[PHP-DEV] [VOTE] Allow non-variable arguments to empty()

2012-04-18 Thread Nikita Popov
Hey internals :) As there doesn't seem to be any further discussion regarding my RFC, I've opened the vote: https://wiki.php.net/rfc/empty_isset_exprs#vote Nikita -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-DEV] Re: Addition of calendar to intl

2012-04-18 Thread Stas Malyshev
Hi! > I think the documentation part in this case is not as problematic, > because the interface has been thoroughly documented in the ICU > project. Most of your next questions can be answered by reading > > http://userguide.icu-project.org/datetime/calendar This is ICU docs, not PHP docs. Most

Re: [PHP-DEV] [RFC] skipping optional parameters

2012-04-18 Thread Stas Malyshev
Hi! > Not sure what you mean here. What is this "varargs return"? As far as I zend_parse_parameters has varargs options. See how var_dump is implemented. > the number of arguments actually passed. But even if it returned the > number of arguments passed, it would be irrelevant because you wo

Re: [PHP-DEV] Ability to assign new object to a class property.

2012-04-18 Thread Richard Lynch
On Sun, April 15, 2012 5:47 pm, Simon Schick wrote: > Just to add a random thought > When do you expect this code to be executed? > > class Foo { > static public $foo = new StdClass(); > } I may be too late to this party, but... For what it's worth, if the non-scalar initialization in cl

Re: [PHP-DEV] [RFC] skipping optional parameters

2012-04-18 Thread Gustavo Lopes
On Wed, 18 Apr 2012 22:34:23 +0200, Stas Malyshev wrote: Hi! This would cause a lot of problems. Basically, all the functions that rely on ZEND_NUM_ARGS() will have to be changed. You can't tell if a parameter was passed or not by relying on it. ZEND_NUM_ARGS() would probably work sin

Re: [PHP-DEV] Re: [RFC] skipping optional parameters

2012-04-18 Thread Stas Malyshev
Hi! > "default" is already a reserved keyword. It's used in switch > constructs. So it is safe to use :) Ah, silly me, indeed it is. Then I guess it doesn't hurt to add it as an option. Will do. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227

Re: [PHP-DEV] Re: [RFC] skipping optional parameters

2012-04-18 Thread Nikita Popov
On Wed, Apr 18, 2012 at 10:24 PM, Stas Malyshev wrote: > Hi! > >> My one comment, which others have raised, is readability of multiple >> commas -- TBH, at first glance it has the appearance of a mistake. I >> think those suggesting a keyword such as "default" make a good point in >> this regard -

Re: [PHP-DEV] [RFC] skipping optional parameters

2012-04-18 Thread Stas Malyshev
Hi! > This would cause a lot of problems. Basically, all the functions that rely > on ZEND_NUM_ARGS() will have to be changed. You can't tell if a parameter > was passed or not by relying on it. ZEND_NUM_ARGS() would probably work since IIRC it relies on stack size, not on varargs return. Yes, th

Re: [PHP-DEV] Re: [RFC] skipping optional parameters

2012-04-18 Thread Stas Malyshev
Hi! > My one comment, which others have raised, is readability of multiple > commas -- TBH, at first glance it has the appearance of a mistake. I > think those suggesting a keyword such as "default" make a good point in > this regard -- it makes it 100% clear that you want the default value I wou

Re: [PHP-DEV] [RFC] skipping optional parameters

2012-04-18 Thread Gustavo Lopes
On Wed, 18 Apr 2012 00:54:41 +0200, Stas Malyshev wrote: [snip] https://wiki.php.net/rfc/skipparams [snip] «For internal functions, parameter parser will ignore the NULLs, thus leaving the defaults supplied by the caller intact. Again, skipping non-optional parameter is an error.» This woul

Re: [PHP-DEV] [RFC] skipping optional parameters

2012-04-18 Thread Stas Malyshev
Hi! > I'll keep going offtopic a bit more. > I would rather see named parameters implemented *prior* to this. I'd rather see named parameters implemented already in 5.0. But somehow that didn't happen :) It's on my todo list though if nobody beats me to it. -- Stanislav Malyshev, Software Archit

Re: [PHP-DEV] Re: New Feature: Fully qualified class name resolution as scalar with class keyword

2012-04-18 Thread Stas Malyshev
Hi! > As already mentioned, There can't be a class constant called "class", > because it is a keyword. (const class = 'Foo' is a syntax error). It looks like class constant. So it should work like one (or, in this case, not work since as you noticed there can not be one). > But yes, I agree that

Re: [PHP-DEV] [RFC] skipping optional parameters

2012-04-18 Thread Richard Lynch
On Tue, April 17, 2012 6:23 pm, Jordi Boggiano wrote: > On 18.04.2012 00:54, Stas Malyshev wrote: >> One of the annoying things I've encountered in working with PHP was >> dealing with functions having long optional parameter lists, >> especially >> if you need to change only the last one - you hav

Re: [PHP-DEV] [RFC] skipping optional parameters

2012-04-18 Thread Pierrick Charron
I like the idea. In fact I started to implement it some time ago, but your patch is really cleaner than mine :) Otherwise I would prefer to insert the default keyword to make the code more readable. It might be hard to count when you have something like function(true); P. On 17 April 2012 18

Re: [PHP-DEV] Some Stats

2012-04-18 Thread Daniel Brown
On Tue, Apr 17, 2012 at 18:13, Kris Craig wrote: >> > Yeah one of the problems that really frustrates the hell out of me is that, > after I've answered a question or responded to an objection, somebody new > jumps in and raises the exact same issue.  When I tell them to read earlier > in the threa

Re: [PHP-DEV] voting without vcs accounts

2012-04-18 Thread Ferenc Kovacs
> > > And I wonder why that should have more precise rules than the ones we > use to hand out accounts. Basically every candidate I imagine could get > a "proper" account easily, if they want. - we have a dedicated page for requesting vcs account - we also have an agreed upon, loosely defin

Re: [PHP-DEV] voting without vcs accounts

2012-04-18 Thread Johannes Schlüter
On Wed, 2012-04-18 at 10:23 +0200, Gustavo Lopes wrote: > I think the issue is not who, in general terms, can vote, but how a > determination that someone is covered by those terms is made. > > What is a "known" OSS project? For instance, which of these would > qualify: > http://en.wikipedia.o

[PHP-DEV] Re: [RFC] skipping optional parameters

2012-04-18 Thread Matthew Weier O'Phinney
On 2012-04-17, Stas Malyshev wrote: > One of the annoying things I've encountered in working with PHP was > dealing with functions having long optional parameter lists, especially > if you need to change only the last one - you have to copy all the > defaults. Full named params implementation woul

Re: [PHP-DEV] Re: New Feature: Fully qualified class name resolution as scalar with class keyword

2012-04-18 Thread Nikita Popov
On Wed, Apr 18, 2012 at 1:21 AM, Stas Malyshev wrote: > Hi! > >> Well, not that you mention it, I don't see a reason why we shouldn't >> add run-time resolution where necessary. For once this would allow > > Runtime resolution of what? We already have get_class(), > get_called_class() and __NAMESP

Re: [PHP-DEV] [RFC] skipping optional parameters

2012-04-18 Thread Lester Caine
Daniel Macedo wrote: I am sorry Lester, but you seem to be getting the "optional parameter" backwards. You are supposed to use the optional parameters when it's up to the library/function definition to determine it's value, not when the value is what you want for this particular function call!

[PHP-DEV] 答复: [PHP-DEV] [RFC] skipping optional parameters

2012-04-18 Thread 高春辉
+1. I LIKE https://wiki.php.net/rfc/namedparameters , please change OLD decide. -邮件原件- 发件人: Ferenc Kovacs [mailto:tyr...@gmail.com] 发送时间: 2012年4月18日 15:19 收件人: Stas Malyshev 抄送: PHP Internals 主题: Re: [PHP-DEV] [RFC] skipping optional parameters On Wed, Apr 18, 2012 at 12:54 AM, Stas Mal

Re: [PHP-DEV] [RFC] skipping optional parameters

2012-04-18 Thread Daniel Macedo
I am sorry Lester, but you seem to be getting the "optional parameter" backwards. You are supposed to use the optional parameters when it's up to the library/function definition to determine it's value, not when the value is what you want for this particular function call! What you seem to be cur

Re: [PHP-DEV] [RFC] skipping optional parameters

2012-04-18 Thread Stefan Neufeind
On 04/18/2012 01:05 PM, Arvids Godjuks wrote: > I personally would vote for the "default" keyword if I want to skip the > param rather than just doing it with , - the keyword approach is much more > readable and error prone. I also agree that the "comma-train" (multiple commas without anything inb

Re: [PHP-DEV] [RFC] skipping optional parameters

2012-04-18 Thread Arvids Godjuks
I personally would vote for the "default" keyword if I want to skip the param rather than just doing it with , - the keyword approach is much more readable and error prone.

Re: [PHP-DEV] [RFC] skipping optional parameters

2012-04-18 Thread Lester Caine
Daniel Macedo wrote: function fn1($a = false, $b = nul, $c = 1) { var_dump($a, $b. $c); } // your idea fn1(NULL, NULL, 10), // NULL, NULL, 10 // vs. using a reserved word fn1(default, default, 10), // FALSE, NULL, 10 Of cause one little problem here is if the default gets changed in the 'l

Re: [PHP-DEV] [RFC] skipping optional parameters

2012-04-18 Thread Peter Cowburn
On 18 April 2012 11:38, Daniel Macedo wrote: > You can't do that, NULL is a perfectly acceptable value to pass into a > function, you wouldn't be able to know when you wanted to pass NULL or > use the default value, e.g.: > > You totally missed the point: hinting, not-so-subtly, at the long-estab

Re: [PHP-DEV] HEADS UP: Force pushed to revert to d55afe4df63945a6e3abe9892ba7836f83c74265

2012-04-18 Thread Johannes Schlüter
On Wed, 2012-04-18 at 12:35 +0200, Johannes Schlüter wrote: > Hi, > > the master branch was accidentally merged into the 5.4 branch. I > reverted that by force pushing the old revision > d55afe4df63945a6e3abe9892ba7836f83c74265 into PHP-5.4 and then > cherry-picking all revisions since then. Pleas

Re: [PHP-DEV] [RFC] skipping optional parameters

2012-04-18 Thread Daniel Macedo
You can't do that, NULL is a perfectly acceptable value to pass into a function, you wouldn't be able to know when you wanted to pass NULL or use the default value, e.g.: function fn1($a = false, $b = nul, $c = 1) { var_dump($a, $b. $c); } // your idea fn1(NULL, NULL, 10), // NULL, NULL, 10 //

[PHP-DEV] HEADS UP: Force pushed to revert to d55afe4df63945a6e3abe9892ba7836f83c74265

2012-04-18 Thread Johannes Schlüter
Hi, the master branch was accidentally merged into the 5.4 branch. I reverted that by force pushing the old revision d55afe4df63945a6e3abe9892ba7836f83c74265 into PHP-5.4 and then cherry-picking all revisions since then. Please take a look and double-check that nothing was lost. If you pulled wit

Re: [PHP-DEV] [RFC] skipping optional parameters

2012-04-18 Thread Peter Cowburn
On 18 April 2012 10:25, Daniel Macedo wrote: > But I couldn't support the comma train, for the insane «lots of > parameters» case, would hate to read some fn($some $var,,, $other) > call. > I'd rather reuse a reserved word like 'default' (or even get a shorter > one?) > > How about "null"? (T

Re: [PHP-DEV] [RFC] skipping optional parameters

2012-04-18 Thread Lester Caine
Adam Jon Richardson wrote: I disagree with the suggestion that the "real" solution is to refactor functions. Is a function with 3 parameters too long? function foo($val1, $val2 = true, $val3 = false) { /* code */} If I want to pass in a value to the third argument but keep the default value for

Re: [PHP-DEV] [RFC] skipping optional parameters

2012-04-18 Thread Daniel Macedo
I'll keep going offtopic a bit more. I would rather see named parameters implemented *prior* to this. Although maybe not instead, I think both might have their place. On Wed, Apr 18, 2012 at 08:43, Yasuo Ohgaki wrote: > > Something like > > setcookie( name:'mycookie', value:'abc', secure:true, ht

Re: [PHP-DEV] [RFC] skipping optional parameters

2012-04-18 Thread Christian Kaps
Am 18.04.2012 09:18, schrieb Ferenc Kovacs: On Wed, Apr 18, 2012 at 12:54 AM, Stas Malyshev wrote: Hi! One of the annoying things I've encountered in working with PHP was dealing with functions having long optional parameter lists, especially if you need to change only the last one - you hav

Re: [PHP-DEV] [RFC] skipping optional parameters

2012-04-18 Thread Pierre Joye
hi Stas, On Wed, Apr 18, 2012 at 12:54 AM, Stas Malyshev wrote: > create_query("deleted=0", "name",,, /*report_errors*/ true); I like the concept, a lot :) Indeed there is the "code written for only this version and above", from a syntax point of view. But that's something I do not care much

Re: [PHP-DEV] [off] PHP: a fractal of bad design

2012-04-18 Thread Philip Olson
On Apr 18, 2012, at 1:34 AM, Hartmut Holzgraefe wrote: > On 04/10/2012 06:20 PM, Adir Kuhn wrote: >> Hi folks, >> >> today I read this post, I think that some points are valid, follow the link >> for >> you guys > > as stuff like this comes up again and again (although not in as epic > lenght

Re: [PHP-DEV] [off] PHP: a fractal of bad design

2012-04-18 Thread Hartmut Holzgraefe
On 04/11/2012 05:19 PM, Luke Scott wrote: > The only thing that infuriates me is the ternary operator being left > associative. I want that fixed - screw bc on that one! I have been > programming for 10 years and that one still confuses me! Most people > just add parentheses to "fix" the problem.

Re: [PHP-DEV] [off] PHP: a fractal of bad design

2012-04-18 Thread Hartmut Holzgraefe
On 04/10/2012 06:20 PM, Adir Kuhn wrote: > Hi folks, > > today I read this post, I think that some points are valid, follow the link > for > you guys as stuff like this comes up again and again (although not in as epic lenght as this one) i've been thinking whether it might make sense to have so

Re: [PHP-DEV] [RFC] skipping optional parameters

2012-04-18 Thread Adam Jon Richardson
On Wed, Apr 18, 2012 at 1:56 AM, Alexey Shein wrote: > Hi! > > My opinion is that solution tries to overcome bad consequences of > legacy code, when it's not feasible to change something without > breakage a lot of code, although the real solution is to refactor > functions with long variable lis

Re: [PHP-DEV] [RFC] skipping optional parameters

2012-04-18 Thread Yasuo Ohgaki
Hi, 2012/4/18 Ryan McCue : > Yasuo Ohgaki wrote: >> >> Something like >> >> setcookie( name:'mycookie', value:'abc', secure:true, httponly:true ); >> >> is really nice to have. Source code will be much more readable. > > > This is getting off-topic, but while we're here, I think: > > setcookie($na

Re: [PHP-DEV] voting without vcs accounts

2012-04-18 Thread Gustavo Lopes
On Wed, 18 Apr 2012 07:34:06 +0200, Pierre Joye wrote: On Wed, Apr 18, 2012 at 12:50 AM, Stas Malyshev wrote: I have a problem that we don't have understanding of what is the goal of this whole vote setup. What is it for? What we will be doing with it? And please don't say "it says so in

Re: [PHP-DEV] [RFC] skipping optional parameters

2012-04-18 Thread Michael Wallner
On 18 April 2012 01:23, Jordi Boggiano wrote: > On 18.04.2012 00:54, Stas Malyshev wrote: >> https://wiki.php.net/rfc/skipparams >> >> Basically, it allows you to do this: >> >> create_query("deleted=0", "name",,, /*report_errors*/ true); +1 > - Would it be possible to allow trailing commas in

Re: [PHP-DEV] voting without vcs accounts

2012-04-18 Thread Lester Caine
Pierre Joye wrote: I am ignoring the comment about FUDs because I have no idea what it is > about, so I guess you are answering somebody other's comment that I have > not read. It was not for you directly but the voting opponent (the very few we have) who cannot get over it. However you are ri

Re: [PHP-DEV] [RFC] skipping optional parameters

2012-04-18 Thread Ryan McCue
Yasuo Ohgaki wrote: Something like setcookie( name:'mycookie', value:'abc', secure:true, httponly:true ); is really nice to have. Source code will be much more readable. This is getting off-topic, but while we're here, I think: setcookie($name => 'mycookie', $value => 'abc'); ...would be be

Re: [PHP-DEV] [RFC] skipping optional parameters

2012-04-18 Thread Yasuo Ohgaki
Hi, 2012/4/18 Ferenc Kovacs : > I would prefer Named parameters, but this is still better than the current > situation. Something like setcookie( name:'mycookie', value:'abc', secure:true, httponly:true ); is really nice to have. Source code will be much more readable. Regards, -- Yasuo Ohgak

Re: [PHP-DEV] [RFC] skipping optional parameters

2012-04-18 Thread Ferenc Kovacs
On Wed, Apr 18, 2012 at 12:54 AM, Stas Malyshev wrote: > Hi! > > One of the annoying things I've encountered in working with PHP was > dealing with functions having long optional parameter lists, especially > if you need to change only the last one - you have to copy all the > defaults. Full named

Re: [PHP-DEV] [RFC] skipping optional parameters

2012-04-18 Thread Adam Harvey
On 18 April 2012 06:54, Stas Malyshev wrote: > create_query("deleted=0", "name",,, /*report_errors*/ true); I like it. At the risk of bikeshedding, can we have a token rather than just a series of commas — say reusing the default keyword so it would look like this instead: create_query("deleted=

Re: [PHP-DEV] voting without vcs accounts

2012-04-18 Thread Pierre Joye
hi Stas, On Wed, Apr 18, 2012 at 8:58 AM, Stas Malyshev wrote: > Hi! > >> The goal is to have community leader participating in our design >> discussions and decisions. It has happened already for a couple of >> RFCs (accepted and rejected) and went very well. The FUDs about core >> devs, legacy

Re: [PHP-DEV] voting without vcs accounts

2012-04-18 Thread Stas Malyshev
Hi! > The goal is to have community leader participating in our design > discussions and decisions. It has happened already for a couple of > RFCs (accepted and rejected) and went very well. The FUDs about core > devs, legacy developers and the like loosing control about the > direction PHP takes