Re: [PHP-DEV] ArrayAccess::offsetGet not returning a ref

2010-08-06 Thread Gustavo Lopes
On Sat, 07 Aug 2010 03:55:25 +0100, Etienne Kneuss wrote: Returning a ref is an additional constraint, meaning that it would actually be covariance, and not contravariance. But yes, it makes sense. Yes, you are right. To put it another way: a subclass should be able to * Relax the precon

Re: [PHP-DEV] Indexing an array

2010-08-06 Thread Stas Malyshev
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 for such behavior, do you have any other one t

Re: [PHP-DEV] ArrayAccess::offsetGet not returning a ref

2010-08-06 Thread Stas Malyshev
Hi! In my opinion, it would make more sense, as was already suggested before, to require the return to be passed by reference only if the prototype specifies it should be passed by reference. This could be argued to be a form of return contravariance. Yes, this makes sense. -- Stanislav Malys

Re: [PHP-DEV] ArrayAccess::offsetGet not returning a ref

2010-08-06 Thread Gustavo Lopes
On Fri, 06 Aug 2010 15:50:33 +0100, Ralph Schindler wrote: The attached patch is the suggested fix. I made this against master on github. In my opinion, it would make more sense, as was already suggested before, to require the return to be passed by reference only if the prototype spe

Re: [PHP-DEV] Indexing an array

2010-08-06 Thread Hannes Magnusson
On Fri, Aug 6, 2010 at 16: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: > I don't think it makes sense. You can howeve

Re: [PHP-DEV] ArrayAccess::offsetGet not returning a ref

2010-08-06 Thread Ralph Schindler
The attached patch is the suggested fix. I made this against master on github. -ralph Ralph Schindler wrote: I can give 2 examples, one that triggers the problem, the other that is a real world issue: --- Simple: PHP Fatal error: Declaration of C::foo() must be compatible with that of I

Re: [PHP-DEV] Indexing an array

2010-08-06 Thread Richard Quadling
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: > > - closure > - object > - etc. > > Thanks > > -- Ma

Re: [PHP-DEV] Indexing an array

2010-08-06 Thread Gustavo Lopes
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: - closure - object - etc. I think the probl

[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] ArrayAccess::offsetGet not returning a ref

2010-08-06 Thread Ralph Schindler
I can give 2 examples, one that triggers the problem, the other that is a real world issue: --- Simple: PHP Fatal error: Declaration of C::foo() must be compatible with that of I::foo() in path/to/test-reference-in-signature.php on line 8 Real world issue with ArrayAccess: array(1

Re: [PHP-DEV] ArrayAccess::offsetGet not returning a ref

2010-08-06 Thread Derick Rethans
On Tue, 27 Apr 2010, Etienne Kneuss wrote: > Hi, > > it looks like the fact that ArrayAccess::offsetGet is not returning a > reference is a recurrent problem, I see basically 4 options: > > a) Ignore the issue, change nothing > > b) Rewrite offsetGet to return a ref, breaking BC > > c) Create

Re: [PHP-DEV] Feature proposal: userland support for name qualification

2010-08-06 Thread Ignas Rudaitis
Hi, well, my apologies for not making that clear enough. I suppose it wouldn't require any runtime information, as this kind of construct could be expanded at compile time. For example: willUse('LibraryWithAVeryLongName\Cache\FileCache') ->willUse('LibraryWithAVeryLongName\Routing\Cach