Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69432 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 89895 invoked from network); 1 Oct 2013 11:16:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Oct 2013 11:16:26 -0000 Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.128.41 as permitted sender) X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.128.41 mail-qe0-f41.google.com Received: from [209.85.128.41] ([209.85.128.41:36048] helo=mail-qe0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1D/41-17232-90FAA425 for ; Tue, 01 Oct 2013 07:16:25 -0400 Received: by mail-qe0-f41.google.com with SMTP id 1so4842374qee.14 for ; Tue, 01 Oct 2013 04:16:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=ptk5qbH1Z+71VHsp2MC5Xr6eD7om0haR3icJI8i4hrQ=; b=N5xTkHqOU5wRZ10YrhOGXmVfCLwKrK1qvrs51KHYbWJxAabicuRbZ6IbW95xx73jdJ qgX4GIIs7TjlvvjnELYjeVb2FBn1+zs3YGoJhWHWn0vAd4xrq5atqfd3OuRo1ZwwB6Kh 5Z9Jj41wJW50XGX2iSa1u37NfJ9LGC/L3gG9CuvLrfJfRPUgDy7r8Q8gIzl7M86AIl9b 46H+nazkvTxKAILjSlvRo3OcqVChYlwYPOsuwuaxPn28lWBPb4UD8ty1GBp6Om+R8YsZ duR4k9Kjeq+mTWuKpfAQiByI8NSfazUAe7sfOVirIPp5Ma/eGWAi8RS0nsgpItn+isnN eefQ== MIME-Version: 1.0 X-Received: by 10.229.192.6 with SMTP id do6mr34597856qcb.3.1380626183007; Tue, 01 Oct 2013 04:16:23 -0700 (PDT) Received: by 10.140.22.71 with HTTP; Tue, 1 Oct 2013 04:16:22 -0700 (PDT) In-Reply-To: <5D.40.07863.EB798425@pb1.pair.com> References: <5D.40.07863.EB798425@pb1.pair.com> Date: Tue, 1 Oct 2013 13:16:22 +0200 Message-ID: To: Joe Watkins Cc: PHP Internals Content-Type: multipart/alternative; boundary=001a11336aa634b44204e7ac15ac Subject: Re: [PHP-DEV] RFC: Draft: Nested Classes From: tyra3l@gmail.com (Ferenc Kovacs) --001a11336aa634b44204e7ac15ac Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Sun, Sep 29, 2013 at 11:12 PM, Joe Watkins wrote: > Hi All, > > I'd like to RFC on Nested Classes (Draft): > > https://wiki.php.net/rfc/**nested_classes > > There's been a little bit of discussion already about it, in the usua= l > places mostly, but also while considering anonymous classes on the lists > ... time to make it public I guess ... > > Cheers > Joe > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > Hi Joe, I really like the idea, as it is a recurring problem that you create a library/package, what you want others to use, but there are some parts of it, which you want to keep as a blackbox to your users, so you can change it in the future, without breaking their code. Currently if you want hard guarantees your only option is to keep that kind of code in private functions, and if you put that into logically separated classes, your only option is to use docblock comments like the @api to hint that which parts are intended for consumption, but sadly nobody really follows that. So I would really like the idea of having classes which can only be accessed from that specific component, but sadly we don't have real packages in php with package level visibility as that could also solve this problem. Having nested classes could be still really useful in this scenario, so I'm +1 on this feature, but there are a couple of questions I would like to see answered: 1. Would there be reflection support for this feature (currently you can access private methods/properties through Reflection, I think it would m= ake sense to be able to do the same with the nested classes). 2. Would it be possible to serialize/unserialize a class referencing an instance of a nested class without losing the information it holds? 3. What happens when a nested class with the same name is used in two separate class? What do you think? --=20 Ferenc Kov=C3=A1cs @Tyr43l - http://tyrael.hu --001a11336aa634b44204e7ac15ac--