Hi,

Joe Watkins wrote (for fun) a new operator, `addressof`. Code is here:
https://github.com/krakjoe/php-src/compare/addressof

I think it makes more sense than a new method on all objects. You could use
it for any kind of value: scalar, resource, object. Building an array of
sockets, for example, would be very easy with such an operator.

It would also give better tools to deal with situations such as:

$test = 1;
$test2 &= $test;

I'm willing to write an RFC if necessary to include it.

Thoughts?

On Thu, Sep 25, 2014 at 11:50 AM, Pierre Joye <pierre....@gmail.com> wrote:

> On Wed, Sep 24, 2014 at 9:44 PM, Andrea Faulds <a...@ajf.me> wrote:
> >
> > On 24 Sep 2014, at 20:39, Stas Malyshev <smalys...@sugarcrm.com> wrote:
> >
> >>> I also wonder why we still need them. Doing what has been done with gmp
> >>> for all resources would be a good move for 7.
> >>
> >> In general, I think we do not - IIRC everything resources do objects can
> >> do better now, and the problems that prevented one from using objects
> >> instead of resources are long gone.
> >>
> >> However, is_resource() checks and lots of third-party extensions using
> >> resources may be a bit of a problem for eliminating them.
> >
> > I already figured out how to solve the `is_resource()` issue. Create an
> almost-useless, uninstantiatable class called Resource which any new
> resource-replacing classes inherit from. Then, make `is_resource()` check
> whether something is an instance of that class.
> >
> > Of course, 3rd-party extensions are still a problem, but this should
> mostly fix it. Of course, gettype() is still going to return “object” not
> “resource”, but I suspect people are more likely to use is_resource().
>
> Is it really necessary? I could imagine a transition with 5.7 for
> that, similar to gmp.
>
> Cheers,
> --
> Pierre
>
> @pierrejoye | http://www.libgd.org
>



-- 

Regards,

*Florian Margaine*

Reply via email to