Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72976 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 41402 invoked from network); 6 Mar 2014 13:53:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Mar 2014 13:53:31 -0000 Authentication-Results: pb1.pair.com smtp.mail=chobieee@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=chobieee@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.54 as permitted sender) X-PHP-List-Original-Sender: chobieee@gmail.com X-Host-Fingerprint: 209.85.220.54 mail-pa0-f54.google.com Received: from [209.85.220.54] ([209.85.220.54:50247] helo=mail-pa0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 12/82-27185-9DD78135 for ; Thu, 06 Mar 2014 08:53:30 -0500 Received: by mail-pa0-f54.google.com with SMTP id lf10so2683530pab.13 for ; Thu, 06 Mar 2014 05:53:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=hkJJfROstKU+2Nyd1xfRL2YCEiEuPqS97m8vbl6RgaM=; b=lxkVmqEvl83JMlEVwG8wYeKrlftRZyD4a5xyTRpSiDy8vzAkHmZ/0B0m7JD9Ypza3N kkgkAG4Q4dpr1Iy2deDS6nTc2GP4dMflb7RJCntWuN2y9GJeszX6vExSR3AM/UimIPwN W1VTfiDIlPAMd99JmGCrVYUgd+ZaYw9eu8A6D5rUPhoC7OqOE1IWzMU4kYO7am44E6cB m6p0mA+tnrWD2h/mD2WduwrsiZtaTB3lfppAEarpStoqmbL43/PgS/9iKGLVIjXvpUAA W4U02dPXNOReJi67hCJrxw7ymr0NsBdCuX1ZHAF7B8qSUwU96fAI1QrGc5Jeq87FpQbl wy1Q== MIME-Version: 1.0 X-Received: by 10.68.248.7 with SMTP id yi7mr14558778pbc.31.1394114006965; Thu, 06 Mar 2014 05:53:26 -0800 (PST) Sender: chobieee@gmail.com Received: by 10.68.204.198 with HTTP; Thu, 6 Mar 2014 05:53:26 -0800 (PST) In-Reply-To: <531675D6.1030203@sugarcrm.com> References: <5307B1FE.1020604@marc-bennewitz.de> <531675D6.1030203@sugarcrm.com> Date: Thu, 6 Mar 2014 22:53:26 +0900 X-Google-Sender-Auth: K-1z6u51gp8a3SF_OklQsoYuIuc Message-ID: To: Stas Malyshev Cc: Marc Bennewitz , PHP internals Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] [php6] OOP resources From: chobieeee@php.net ("Shuhei Tanuma (chobie)") 2014-03-05 9:54 GMT+09:00 Stas Malyshev : > 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. I've maintained libgit2, libuv and several entrepreneurial libraries. occasionally, those libraries brakes BC. I have to get rid of some OOP interfaces if they broke BC. Eventually, I prefer procedural programming to OOP in that cases. and resource object forcing object oriented programming I think. for example, `int git_repository_index(git_index **out, git_repository *repo);` http://libgit2.github.com/libgit2/#v0.20.0/group/repository/git_repository_index and most developer might expect correct inheritance for resource object. (I know this is tread off) for example, `uv_read_stop` accepts tcp, pipe and tty resources. UVTcp ` UVStream `UVHandle then uv_read_stop signature will be this. uv_read_stop(UVStream $stream, Closure $callback); But developer might thought why this api is not OOP like `UVStream->readStop(Closure $callback)`? I think to choose resource object is forcing objective oriented programming. >> 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