Re: [PHP-DEV] Named parameters

2010-10-18 Thread mathieu.suen
On 10/15/2010 07:26 PM, G M wrote: Okay so I am thinking about submitting a patch to PHP that would enable you to call functions like this: stuff(1, 2, 'separator' => '', 'clean' => true); and define them like this: /** * function to do stuff * @param integer $a * @param integer $b

Re: [PHP-DEV] inheritance check too strict?

2010-08-19 Thread mathieu.suen
Title: Document sans nom I consider having type in the declaration of a method a bad idea and this thread just prove it. You can also read this: http://gbracha.blogspot.com/2009/09/systemic-overload.html On 08/19/2010 10:32 AM, Johannes Schlüter wrote: On Thu, 2010-08-19 at 01:13 -0700, Sta

Re: [PHP-DEV] Indexing an array

2010-08-09 Thread mathieu.suen
On 08/06/2010 07:46 PM, Stas Malyshev wrote: Hi! For now you can only index an array using a scalar type or a string. Is there some rfc or work going on to enlarge the possibility so that it is possible to have some other object like: I think SplObjectStorage implements most common use-case f

Re: [PHP-DEV] Indexing an array

2010-08-09 Thread mathieu.suen
On 08/06/2010 04:44 PM, Richard Quadling wrote: On 6 August 2010 15:33, mathieu.suen wrote: Hi, For now you can only index an array using a scalar type or a string. Is there some rfc or work going on to enlarge the possibility so that it is possible to have some other object like

Re: [PHP-DEV] Indexing an array

2010-08-09 Thread mathieu.suen
On 08/06/2010 04:42 PM, Gustavo Lopes wrote: On Fri, 06 Aug 2010 15:33:18 +0100, mathieu.suen wrote: Hi, For now you can only index an array using a scalar type or a string. Is there some rfc or work going on to enlarge the possibility so that it is possible to have some other object like

[PHP-DEV] Indexing an array

2010-08-06 Thread mathieu.suen
Hi, For now you can only index an array using a scalar type or a string. Is there some rfc or work going on to enlarge the possibility so that it is possible to have some other object like: - closure - object - etc. Thanks -- Mathieu Suen

Re: [PHP-DEV] Remove variable function and method calls

2010-07-23 Thread mathieu.suen
On 07/23/2010 10:20 AM, Reindl Harald wrote: Would you like to know what is really confusing? mysql_escape_string mysql_real_escape_string So if you have nothing to do try to cleanup this hint: "mysql_real_escape_string" never should have existed this way and should be dprecated for some relaese

Re: [PHP-DEV] Suggestion: echo function(var)[0];

2010-06-04 Thread mathieu.suen
On 06/04/2010 10:00 AM, Richard Quadling wrote: On 4 June 2010 08:18, mathieu.suen wrote: Hi Why not something more generic. Someone could think of a ValueNode. Then it could be use for object, array, any primitive type ... I will take the ValueNode as a non terminal grammar node. So

Re: [PHP-DEV] Suggestion: echo function(var)[0];

2010-06-04 Thread mathieu.suen
Hi Why not something more generic. Someone could think of a ValueNode. Then it could be use for object, array, any primitive type ... I will take the ValueNode as a non terminal grammar node. So first we could do that: ValueNode->method(); ValueNode::sMethod(); ValueNode[]; foo(ValueNode); ech

Re: [PHP-DEV] Interface and abstract method

2010-05-19 Thread mathieu.suen
s_OuterIterator[] = { SPL_ABSTRACT_ME(OuterIterator, getInnerIterator, arginfo_recursive_it_void) {NULL, NULL, NULL} }; IMO the SPL_ME should be used instead, but I wouldn't be bothered about it ;-) On Tue, May 18, 2010 at 11:12 PM, mathieu.suen wrote: Hi, In the SPL the

[PHP-DEV] Interface and abstract method

2010-05-18 Thread mathieu.suen
Hi, In the SPL there is some interface that have abstract method: *Countable* { /* Methods */ abstract public int count ( void ) } While some interface have "none abstract" method. *OuterIterator* extends Iterator

Re: [PHP-DEV] Re: Closure local return

2010-05-17 Thread mathieu.suen
On 05/03/2010 05:42 PM, Christian Schneider wrote: mathieu.suen wrote: May be it could be interesting to have a syntax for returning from the define scope. For example. $findedElment = $myList->selectIfAbsent($fooo, function(){ return 'No item founded'; //Retrun from the

Re: [PHP-DEV] Re: Closure local return

2010-05-04 Thread mathieu.suen
On 05/03/2010 11:34 PM, Tjerk Anne Meesters wrote: On Mon, May 3, 2010 at 11:42 PM, Christian Schneider wrote: mathieu.suen wrote: May be it could be interesting to have a syntax for returning from the define scope. For example. $findedElment = $myList->selectIfAbsent($f

Re: [PHP-DEV] Re: Closure local return

2010-05-04 Thread mathieu.suen
On 05/03/2010 06:03 PM, Etienne Kneuss wrote: On Mon, May 3, 2010 at 5:54 PM, mathieu.suen wrote: I think you actually misunderstand the difference in http://en.wikipedia.org/wiki/Closure_%28computer_science%29#Differences_in_semantics The way I read if the difference is wether it

Re: [PHP-DEV] Re: Closure local return

2010-05-03 Thread mathieu.suen
I think you actually misunderstand the difference in http://en.wikipedia.org/wiki/Closure_%28computer_science%29#Differences_in_semantics The way I read if the difference is wether it returns from the closure function or the surrounding function *calling* it. Not the *defining* scope. And no,

Re: [PHP-DEV] Closure local return

2010-05-03 Thread mathieu.suen
Of course I am. take a look at: http://en.wikipedia.org/wiki/Closure_%28computer_science%29 Section: Differences in semantics On 05/03/2010 03:27 PM, Jille Timmermans wrote: Are you serious? Op 3-5-2010 15:01, mathieu.suen schreef: Hi, The statement 'return' in a closure is now

[PHP-DEV] Closure local return

2010-05-03 Thread mathieu.suen
Hi, The statement 'return' in a closure is now returning from the scope that evaluate the closure (evaluation scope). It could have been in an other way. It could mean return from the scope were the closure is create (define scope). May be it could be interesting to have a syntax for return

Re: [PHP-DEV] Obscure token name

2010-04-29 Thread mathieu.suen
Steven Van Poeck wrote: Folks, can't you just accept that T_PAAMAYIM_NEKUDOTAYIM is intended to make you smile? There's nothing to see here, please move along. - Martin +1 Don' t you read what I say? So to be clear: I don't car the name of the token. I care not understanding the parser er

Re: [PHP-DEV] Obscure token name

2010-04-29 Thread mathieu.suen
Johannes Schlüter wrote: On Mon, 2010-04-26 at 16:32 +0200, mathieu.suen wrote: I am wondering why is the token name so incomprehensible ? Like T_PAAMAYIM_NEKUDOTAYIM... I don't mind if we change the name in the error message. Seems to be an issue for some ... but I think you ha

Re: [PHP-DEV] Obscure token name

2010-04-27 Thread mathieu.suen
27, 2010, at 2:50 AM, mathieu.suen wrote: Hannes Magnusson wrote: On Mon, Apr 26, 2010 at 16:32, mathieu.suen wrote: Hi, I am wondering why is the token name so incomprehensible ? Like T_PAAMAYIM_NEKUDOTAYIM... "Paamayim Nekudotayim would, at first, seem l

Re: [PHP-DEV] Obscure token name

2010-04-27 Thread mathieu.suen
Stefan Marr wrote: On 27 Apr 2010, at 08:50, mathieu.suen wrote: Then T_DOUBLE_COLON would have been perfectly clear. Honestly, token names in error messages is so '80s. Instead of fixing internal details, form the users point of view it might be better to not expose token names a

Re: [PHP-DEV] Obscure token name

2010-04-26 Thread mathieu.suen
Hannes Magnusson wrote: On Mon, Apr 26, 2010 at 16:32, mathieu.suen wrote: Hi, I am wondering why is the token name so incomprehensible ? Like T_PAAMAYIM_NEKUDOTAYIM... "Paamayim Nekudotayim would, at first, seem like a strange choice for naming a double-colon. However,

[PHP-DEV] Obscure token name

2010-04-26 Thread mathieu.suen
Hi, I am wondering why is the token name so incomprehensible ? Like T_PAAMAYIM_NEKUDOTAYIM... -- Mathieu Suen -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Debugging a PHP Extension via GDB

2010-04-22 Thread mathieu.suen
One quick but ugly way is to add it in assembler in your C file: __asm__("int3"); or something like this. Sebastian Kurfürst wrote: Hi Derick, Try just "break objectmonitor.c:80". Thanks, just tried that, but same issue: (gdb) break objectmonitor.c:80 No source file named objec

[PHP-DEV] What about static/self was: (Re: [PHP-DEV] Closures and $this)

2010-04-20 Thread mathieu.suen
Hi, Also $this have been wildly discuss here, but the same discussion can be apply to static/self. self might be simple to figure out how to bind within a closure. It can be bind to the name of the class where the closure is define. static is a more tricky one but it should be the same thing

Re: [PHP-DEV] Closure improvements in next version ?

2010-04-08 Thread mathieu.suen
There is also the improvement on the scope of $this: *http://tinyurl.com/ybqyskx* Frederic Hardy wrote: Hello ! In bug report http://bugs.php.net/bug.php?id=51326, johannes say that the next major version of PHP (5.4 / 6.0) will have better oo support for closure. Is there any RFC about that

Re: [PHP-DEV] Assign array with __get

2010-03-31 Thread mathieu.suen
Auke van Slooten wrote: Stanislav Malyshev wrote: Hi! IMHO __get is not consistent at the first place. on possible example: It is perfectly consistent. You just need to read what it actually does: http://www.php.net/manual/en/language.oop5.overloading.php#language.oop5.overloading.members

Re: [PHP-DEV] Assign array with __get

2010-03-29 Thread mathieu.suen
Stanislav Malyshev wrote: Hi! IMHO __get is not consistent at the first place. on possible example: It is perfectly consistent. You just need to read what it actually does: http://www.php.net/manual/en/language.oop5.overloading.php#language.oop5.overloading.members instead of imagining wh

Re: [PHP-DEV] horizontal reuse: traits vs. grafts

2010-03-26 Thread mathieu.suen
Stefan Marr wrote: On 26 Mar 2010, at 10:26, mathieu.suen wrote: Variable has been discuss in *http://tinyurl.com/y9t7nd9 Right, and related to that we have freezable traits http://scg.unibe.ch/scgbib?_k=NNRwidu5&query=freezable+traits&display=abstract Which influenced this

Re: [PHP-DEV] horizontal reuse: traits vs. grafts

2010-03-26 Thread mathieu.suen
Stefan Marr wrote: On 25 Mar 2010, at 21:30, Stefan Marr wrote: On 25 Mar 2010, at 16:37, Lukas Kahwe Smith wrote: Hi, this was just brought up on IRC. my understanding is that traits have no concept of properties, but grafts do (all hidden internally). correct? Right, the Tra

Re: [PHP-DEV] Assign array with __get

2010-03-26 Thread mathieu.suen
Stanislav Malyshev wrote: Hi! So what you're saying is that it is *consistent* with regard to the implementation of methods/functions, i.e. __get behaves as an ordinary method. Yes, it does. IMHO __get is not consistent at the first place. on possible example: class A { protected $foo;

Re: [PHP-DEV] Assign array with __get

2010-03-22 Thread mathieu.suen
es what it does now consistently (in this regard) - what you're suggesting breaks that consistency. To gain what, exactly? On 19 March 2010 17:07, mathieu.suen wrote: Right I could work around the issue with the return by reference without any problem. I am still thinking that if you

Re: [PHP-DEV] Assign array with __get

2010-03-19 Thread mathieu.suen
can be happy. I think. On 3/19/10 4:56 AM, Etienne Kneuss wrote: On Thu, Mar 18, 2010 at 5:47 PM, mathieu.suen wrote: Peter Lind wrote: On the contrary, it's quite obvious what's going on. In both examples __get() returns an array as PHP would normally do it (i.e. NOT by reference)

Re: [PHP-DEV] Assign array with __get

2010-03-19 Thread mathieu.suen
Etienne Kneuss wrote: On Thu, Mar 18, 2010 at 5:47 PM, mathieu.suen wrote: Peter Lind wrote: On the contrary, it's quite obvious what's going on. In both examples __get() returns an array as PHP would normally do it (i.e. NOT by reference) which means that if you try to m

Re: [PHP-DEV] Assign array with __get

2010-03-18 Thread mathieu.suen
Peter Lind wrote: On the contrary, it's quite obvious what's going on. In both examples __get() returns an array as PHP would normally do it (i.e. NOT by reference) which means that if you try to modify that you'll end up modifying nothing much. However, in your second example, the point at whic

Re: [PHP-DEV] Assign array with __get

2010-03-18 Thread mathieu.suen
Etienne Kneuss wrote: Hello, On Wed, Mar 17, 2010 at 3:40 PM, mathieu.suen wrote: Ionut G. Stan wrote: Hi, This is interesting and it appears the following change makes the snippet work as expected: public function &__get($name); I think is that the $this->anArr

Re: [PHP-DEV] Assign array with __get

2010-03-17 Thread mathieu.suen
MHO I think that the complexity of the VM is way to hight. That is something I am strongly agree with Gilad Bracha on adding new feature into a language: Look at the last paragraph: http://gbracha.blogspot.com/2009/09/systemic-overload.html On 3/17/10 3:55 PM, mathieu.suen wrote: Hi, I came

[PHP-DEV] Assign array with __get

2010-03-17 Thread mathieu.suen
Hi, I came across a strange behavior when using the magic method __get and some instance variable that should be an array. Consider the following example: class A { public function __get($name) { $this->$name = array(); return $this->$name; } public function test(

Re: [PHP-DEV] Closure/lambda semantic comparaison

2010-03-01 Thread mathieu.suen
Etienne Kneuss wrote: Hello, On Mon, Mar 1, 2010 at 1:33 PM, mathieu.suen wrote: Hi, I am proposing a comparison between PHP closure with lisp one. First thing to compare is how scope are capture: Suppose I want to create a function that add. The common idiom to do it in lisp is: (defun

[PHP-DEV] Closure/lambda semantic comparaison

2010-03-01 Thread mathieu.suen
Hi, I am proposing a comparison between PHP closure with lisp one. First thing to compare is how scope are capture: Suppose I want to create a function that add. The common idiom to do it in lisp is: (defun adder (x) #'(lambda (y) (+ x y))) Then if I want the add3 method you can do: (setf (sy

Re: [PHP-DEV] On closures and lamdba

2010-02-23 Thread mathieu.suen
Stanislav Malyshev wrote: Hi! My question is not so much about implementation it is about language. I have noticed quite a few times now that PHP developers use the word "closure" when I would prefer "lambda". Everybody on the internet knows that Wikipedia is the ultimate source of knowledge

Re: [PHP-DEV] PHP continuations

2010-02-09 Thread mathieu.suen
Sebastian Bergmann wrote: Am 08.02.2010 14:38, schrieb mathieu.suen: I am wondering if there is some effort for having continuation in php. Or is there already some construction for continuation? There is http://phpcontinuation.sourceforge.net/ which I never got around to actually

Re: [PHP-DEV] PHP continuations

2010-02-08 Thread mathieu.suen
troels knak-nielsen wrote: On Mon, Feb 8, 2010 at 2:38 PM, mathieu.suen wrote: Hi, I am wondering if there is some effort for having continuation in php. Or is there already some construction for continuation? phaux (http://code.google.com/p/phaux/) is an attempt at creating a

[PHP-DEV] Iterable object can't return object in key

2010-02-08 Thread mathieu.suen
Hi, Whenever you implement the Iterator interface the key method should only return a scalar. Is there any particular reason for this restriction. IMHO I don't see any. I also don't see why you can't index an array with object but it smells something going wrong underneath. Thanks - Mathieu

[PHP-DEV] PHP continuations

2010-02-08 Thread mathieu.suen
Hi, I am wondering if there is some effort for having continuation in php. Or is there already some construction for continuation? Thanks - Mathieu Suen -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Inconsistency redesign

2010-01-13 Thread mathieu.suen
Etienne Kneuss wrote: Hello, On Wed, Jan 13, 2010 at 2:36 PM, mathieu.suen wrote: Hi, I came across this: echo sizeof(array()); echo sizeof(""); $a = ""; php.net/count: "If var is not an array or an object with implemented Countable interface, 1 will

[PHP-DEV] Inconsistency redesign

2010-01-13 Thread mathieu.suen
Hi, I came across this: echo sizeof(array()); echo sizeof(""); $a = ""; var_dump( empty($a)); $a = array(); var_dump(empty($a)); So funny! How something can have a size greater than 0 but still be empty? I think PHP is reinventing the inconsistency word. But then let assume that empty is just

Re: [PHP-DEV] About optimization

2010-01-13 Thread mathieu.suen
Sebastian Bergmann wrote: Am 13.01.2010 12:18, schrieb mathieu.suen: I would like to know why the opcode is not optimized. Because any optimization, even very simple ones, impose a performance penalty in the default execution model of PHP which does not use a bytecode cache

[PHP-DEV] About optimization

2010-01-13 Thread mathieu.suen
Hi, I would like to know why the opcode is not optimized. Even for some very simple optimization like constant folding. For exemple: line # op fetch ext return operands ---