Re: [php6] OOP resources

From: Date: Wed, 05 Mar 2014 00:54:46 +0000
Subject: Re: [php6] OOP resources
References: 1 2  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Hi!

> I prefer resource as It makes easier to implement bindings.
> I've maintained several extensions. one of the library has 500
> approximates APIs.
> Imagine considering complicated OOP interface is really nightmare...

You don't have to do anything different there - you can still use the
same API. With minimal effort, you can also make the API dual-purpose,
i.e. foo_bar($foo, $bar) and $foo->bar($bar) would do the same. But it
doesn't have to be that, you can also stay with foo_bar($foo, $bar) and
have $foo as object.

> To encapsulate resource data structure to object isn't bad idea.
> but zend_list_insert is more convenient than
> zend_object_store_get_object, isn't it?

What would be the difference? It's pretty much the same API and macros
can be added to eliminate any boilerplate code. See how it's done in
intl, for example.
-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227


Thread (10 messages)

« previous php.internals (#72915) next »