Re: [PHP-DEV] substr/array_slice in []

2007-10-10 Thread Marcus Boerger
Hello Antony, Saturday, October 6, 2007, 8:49:14 PM, you wrote: > On 06.10.2007 22:38, Larry Garfield wrote: >> I have no love for Perl (and a rather strong dislike of it), but I have to >> agree with those who say that "looks like Perl" is a lame reason to reject >> something. PHP's object sy

Re: [PHP-DEV] Re: Q. zend_parse_parameters() - allow grouping of optional parameters.

2007-10-10 Thread Andrei Zmievski
Use quite parameter parsing: if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "lll", &m, &d, &y) != SUCCESS && zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "ll", &m, &d, &y, &h, &min, &s) != SUCCESS && zend_parse_paramet

Re: [PHP-DEV] new feature -> with()

2007-10-10 Thread Keryx Web
Rasmus Lerdorf skrev: I think that is one of the strongest reasons not to implement something actually. If there is a way to do something in a clear and concise syntax, adding an alternate less clear syntax that isn't immediately obvious to everyone simply obfuscates the language. The other fat

[PHP-DEV] Object arithmetic

2007-10-10 Thread Rob Richards
I was wondering why objects are always converted to longs when performing arithmetic. While looking at bug 42780: http://bugs.php.net/bug.php?id=42780 The only way not to lose precision is to explicitly cast the object to float or string, which just doesn't seem right to me. It would be nice if

Re: [PHP-DEV] new feature -> with()

2007-10-10 Thread Stut
Rasmus Lerdorf wrote: Stut wrote: It may not be clear to some people, but there are many things in the every language that aren't necessarily obvious and I don't think that's a reason not to implement something. I think that is one of the strongest reasons not to implement something actually.

Re: [PHP-DEV] new feature -> with()

2007-10-10 Thread Rasmus Lerdorf
Stut wrote: > It may not be clear to some people, but there are many things in the > every language that aren't necessarily obvious and I don't think that's > a reason not to implement something. I think that is one of the strongest reasons not to implement something actually. If there is a way t

Re: [PHP-DEV] new feature -> with()

2007-10-10 Thread Ralph Schindler
--- $class=new class; with($class) { do_something(); do_more(); do(); } What more value does this hold over implementing fluent interfaces which are already possible? Assuming class Foo { public function doSomething() { /**code**/ return $this; } p

Re: [PHP-DEV] new feature -> with()

2007-10-10 Thread BDKR
Hartmut Holzgraefe wrote: When reading foreign C++ code a lot you learn to love the explicit nature of PHP naming scopes even though it is extra typing as it is clear at first sight whether you are looking at a variable, member variable, function, object method ... Lets do not weaken this

Re: [PHP-DEV] new feature -> with()

2007-10-10 Thread Stut
Richard Black wrote: I'm usually a lurker on here, but thought I'd through in my 2p on this one... Delphi (Object Pascal) has a similar feature, that I've had some experience of using, and I never liked it. Why? Because it only leads to confusion, mainly because the separation of object and meth

Re: [PHP-DEV] new feature -> with()

2007-10-10 Thread Hartmut Holzgraefe
Richard Black wrote: [...] for me it doesn't add any value - only potential confusion. +0.9 it makes sense as a convenience tool if used correctly but can create a hell of a maintenance nightmare if not Almost as bad as GOTO maintenance wise but without the benefits in edge cases. When readi

RE: [PHP-DEV] new feature -> with()

2007-10-10 Thread Richard Black
I'm usually a lurker on here, but thought I'd through in my 2p on this one... Delphi (Object Pascal) has a similar feature, that I've had some experience of using, and I never liked it. Why? Because it only leads to confusion, mainly because the separation of object and method leaves you unsure of

[PHP-DEV] new feature -> with()

2007-10-10 Thread Sebastian
hi, i think it would be really handy to introduce the with() feature from JavaScript (and probably other OOP languages) into php. so for sample the following --- $class=new class; $class->do_something(); $class->do_more(); $class->do(); --- coul

[PHP-DEV] Re: Q. zend_parse_parameters() - allow grouping of optional parameters.

2007-10-10 Thread Scott MacVicar
if (ZEND_NUM_ARGS() != 3 && ZEND_NUM_ARGS() != 6 && ZEND_NUM_ARGS() != 7) { WRONG_PARAM_COUNT; } Will let you check that there are 3, 6 and 7 parameters. Scott Richard Quadling wrote: > Hi. > > From what I understand about the argument list for > zend_parse_parameters(), you separate opt

[PHP-DEV] Q. zend_parse_parameters() - allow grouping of optional parameters.

2007-10-10 Thread Richard Quadling
Hi. >From what I understand about the argument list for zend_parse_parameters(), you separate optional parameters from mandatory ones using pipe (|). e.g. if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll|", &m, &d, &y, &h, &n, &s, &ms) == FAILURE) { In the above example, this says