Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72749 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 42509 invoked from network); 21 Feb 2014 21:13:17 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Feb 2014 21:13:17 -0000 Authentication-Results: pb1.pair.com smtp.mail=are.you.winning@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=are.you.winning@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.179 as permitted sender) X-PHP-List-Original-Sender: are.you.winning@gmail.com X-Host-Fingerprint: 209.85.216.179 mail-qc0-f179.google.com Received: from [209.85.216.179] ([209.85.216.179:59087] helo=mail-qc0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4B/54-17822-C61C7035 for ; Fri, 21 Feb 2014 16:13:16 -0500 Received: by mail-qc0-f179.google.com with SMTP id r5so2011700qcx.10 for ; Fri, 21 Feb 2014 13:13:14 -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=7vdVq050ecBIUmo0Pk7E1qjJ6XBhGYo+wAuvbzZbx8M=; b=YQvq4KkNn0nNQX2m0pIQSoGREicd4yh3qDY02gdfNpRn3i+1INjqCXhi/EnXaeAagL pFx+hjk5MfbsWjN5JnT6KWYPVcDniKiMUbZfW71JnvZ5ZzfLTUK8RVOL/VypL1z8oE/K llgx+epQ0hBiSPAhetDVpz/QlXrm0b+0mFSNSFQmLrUxIppjECObg3qlPVEqDXKBWmis 1CjqC6JLesSzkWjWE5fQB0XI/ALFikG6v3mAVrJXgK0Tq3h9tJu/edKFX0QYDJQI79pV G7I/XtArv0U8eFNTxG52leHGdusppGCtQPyDYed/6NDGxE1tIDGSrtR+YlRzQAN8W9ry PKxQ== MIME-Version: 1.0 X-Received: by 10.229.172.4 with SMTP id j4mr13282990qcz.6.1393017193820; Fri, 21 Feb 2014 13:13:13 -0800 (PST) Sender: are.you.winning@gmail.com Received: by 10.229.240.193 with HTTP; Fri, 21 Feb 2014 13:13:13 -0800 (PST) In-Reply-To: <5307B1FE.1020604@marc-bennewitz.de> References: <5307B1FE.1020604@marc-bennewitz.de> Date: Fri, 21 Feb 2014 21:13:13 +0000 X-Google-Sender-Auth: KVuM5CJsARqFLeIZ0UOdU7nB6ow Message-ID: To: Marc Bennewitz Cc: "internals@lists.php.net" Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] [php6] OOP resources From: daverandom@php.net (Chris Wright) On 21 February 2014 20:07, Marc Bennewitz wrote: > Hi, > > here another idea for PHP 6 the simply means removing the datatype > "resource" because and convert current resources into classes/objects > as it's already done with GMP. > > Because resources are simply a pointer to a somewhere described data > structure - resources are the exactly the use case for objects. I'm a big fan of this idea in principle, resources have always struck me as just a messier way of dealing with objects. However, to go through every usage of the resource type an convert them is a mammoth task, because I don't there being any point in doing it unless the procedural APIs that use them are given an OO overhaul. The vast majority of the time they are used in the context of `_action_name($resource, ...$args)`, and if they were converted to objects a `$resource->action_name()` method is what I would expect. The procedural APIs could still be maintained, much like MySQLi. I don't see the goal of completely removing the resource type as being practical or, considering how many PECL and custom extensions this would affect, sensible. However, I'd be all for a general push to convert/duplicate as many core resource-oriented APIs as possible to OO APIs. > To be bc current resources should be instances of an interface > "Resource" and the function "is_resource" would work similar as > "$resource instanceof Resource". And, more importantly, it will become a lot easier (in many cases, simply "possible") to determine what a "resource" is actually for. In reality is_resource() isn't hugely useful, I can't call fwrite() on a stream context resource, for example.