Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69275 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46916 invoked from network); 23 Sep 2013 15:03:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Sep 2013 15:03:14 -0000 Authentication-Results: pb1.pair.com header.from=are.you.winning@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=are.you.winning@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.181 as permitted sender) X-PHP-List-Original-Sender: are.you.winning@gmail.com X-Host-Fingerprint: 209.85.212.181 mail-wi0-f181.google.com Received: from [209.85.212.181] ([209.85.212.181:45427] helo=mail-wi0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5E/B0-43439-13850425 for ; Mon, 23 Sep 2013 11:03:13 -0400 Received: by mail-wi0-f181.google.com with SMTP id ex4so2397955wid.14 for ; Mon, 23 Sep 2013 08:03:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:references:in-reply-to:subject:date:message-id :mime-version:content-type:content-transfer-encoding:thread-index :content-language; bh=UQcVKCjqQBeQF5Gp/2jvlIcZctimygQmDo1f24mLAGg=; b=ZGwyWMF4xjwJpWJJsxunrJv2jeqZjLU4BZmJ+0QR3J/lLGUysZ8k6xmPVL5YzzOwzM S6+lCdAJiCAfs11zG2YYmEyCqYhO2MbK6qu0FThq9jG/4PVY8UM/8VZnYC9+i/i0eJyl 1B2WVMsKAORVmcHeFg72pf/0ukIU3zE3FFPiblkwvsXblPWB9o1e5Er/lNUcQ4clMNkq gLB8rtQwLi5CaCqwh6D7QqRi6YjdnzCVwci9WdTOw4o3qX8p1EyOi3B5Jl4RoIIUVUrC FJ3fA8CwpB1GInit2/nQMS4B5yYAhTQuqkN+2VEcJn0XHqS+pYvRLszndKmkIrQ699R3 /qvw== X-Received: by 10.180.20.163 with SMTP id o3mr14423851wie.1.1379948590214; Mon, 23 Sep 2013 08:03:10 -0700 (PDT) Received: from CHRISWPC (stockport.aquacool.ltd.uk. [77.107.181.84]) by mx.google.com with ESMTPSA id li9sm26466402wic.4.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 23 Sep 2013 08:03:09 -0700 (PDT) Sender: Chris Wright To: "'Patrick Schaaf'" , "Joe Watkins" Cc: "Lars Strojny" , "internals" References: <52404AB9.2070007@php.net> In-Reply-To: Date: Mon, 23 Sep 2013 16:03:16 +0100 Message-ID: <000901ceb86e$10be3fa0$323abee0$@net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AQHOuCiMaAYxszdDR0qEFzLt5NEhE5nTRM+AgAAGGoCAAAkrAIAAE2RQ Content-Language: en-gb Subject: RE: [PHP-DEV] RFC: Anonymous Classes From: daverandom@php.net ("Chris Wright") > What about UNserialize then? I don't see any way to handle this sensibly, but I also don't regard this as a problem, because that's not what these anonymous classes are for. If you want something that can be unserialised into a thing with methods then logically you know what it is ahead of time, because you know what functionality you want it to have, so you would have a named class for it. If you don't want it to have methods then it's just a value object and stdClass will suffice (you wouldn't have created the anonymous class in the first place). All? the use cases mentioned are centred around interfaces and interfaces don't include values (i.e. properties), which is all that serialisation stores apart from the class name, which by definition doesn't apply to anonymous classes. The opposite of this problem, unserialising anonymous objects into instances of defined classes, would be very useful in many places (especially JSON) but I guess that's another prickly issue for another thread. To summarize how I think this should be handled: Serialisation results in a stdClass, unserialisation cannot be done because if you want it you're already Doing It WrongT.