Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:66391 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99281 invoked from network); 1 Mar 2013 11:12:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Mar 2013 11:12:43 -0000 Authentication-Results: pb1.pair.com header.from=julienpauli@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=julienpauli@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.128.174 as permitted sender) X-PHP-List-Original-Sender: julienpauli@gmail.com X-Host-Fingerprint: 209.85.128.174 mail-ve0-f174.google.com Received: from [209.85.128.174] ([209.85.128.174:48295] helo=mail-ve0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 04/E2-19541-82D80315 for ; Fri, 01 Mar 2013 06:12:42 -0500 Received: by mail-ve0-f174.google.com with SMTP id pb11so2777208veb.33 for ; Fri, 01 Mar 2013 03:12:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=V9seb6wlAG5q+1b8wKsgJp4HlK4v1SaERLZWlfNpGaM=; b=Tbibr97XeHc/5UXyoJub9AsK8nL825mCGRqUQ3Qfj5/85ukuc7E3FyHc5EV4jBeN1h tyJFI96Onrzv8/t5LNSZfugEf1XtwDqNMPO+8KG1T3G+kn+mKb1GJ0iNWqcf3iTpURrs SrWxcFeUuabFE06OFe7CUQuX59cKppwj7OJ6+XKvK9CwQwH85wD61W4cmBSo5/7hTRDJ xxtxnRTyn1XAryrcT4nBJIGwd+1Lq2wdXEQEiFEJvNvQhwsJugzfgq3U2nHX+Kze1jpY wT9rz01a+5+IBOWsIdAQaqUkD4dsmDtuWgrf3RjSZMWuycpYH6ypBleQwrXM8IzlVwEg G8cw== X-Received: by 10.220.155.8 with SMTP id q8mr3801298vcw.42.1362136358090; Fri, 01 Mar 2013 03:12:38 -0800 (PST) MIME-Version: 1.0 Sender: julienpauli@gmail.com Received: by 10.220.140.132 with HTTP; Fri, 1 Mar 2013 03:11:57 -0800 (PST) In-Reply-To: References: <7E088EEC-ACB7-4977-BE00-CEA17ABD6EC3@me.com> Date: Fri, 1 Mar 2013 12:11:57 +0100 X-Google-Sender-Auth: 8wXgYFmp_ma7vTJlGq1zG7X6QIg Message-ID: To: Lazare Inepologlou Cc: Sebastian Krebs , Jens Riisom Schultz , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=f46d043bdf9ec2afad04d6db1514 Subject: Re: [PHP-DEV] I would like to write an RFC for the addition of an internal keyword From: jpauli@php.net (Julien Pauli) --f46d043bdf9ec2afad04d6db1514 Content-Type: text/plain; charset=ISO-8859-1 On Thu, Feb 28, 2013 at 12:40 PM, Lazare Inepologlou wrote: > Hello, > > please read my comment inline... > > 2013/2/28 Sebastian Krebs > > > 2013/2/28 Jens Riisom Schultz > > > > > Hi everyone, > > > > > > (I got "hooked off" this discussion, so I have tried to keep up by > > reading > > > the digest... This makes it impossible for me to correctly interleave > my > > > comments, so I'll just "top post" or whatever the term is) (I'm sure > this > > > has been mentioned before but a forum would be so much more accesible > > than > > > this mailing list concept...) > > > > > > > > > * In response to the argument that you want to be able to modify a > > > framework or use it in an unintended manner: > > > This would be possible by explicitly stating "namespace Framework;" in > a > > > given php file. > > > > > > * In response to the argument that php has no assembly concept: > > > I know this, but namespaces are as close as we get, and would > effectively > > > solve this. > > > > > > > No. A namespace is in fact more or less just a prefix, that groups the > > containing elements together. Beside the semantic meaning of grouping > they > > don't have any further abilities, or meaning. > > Without knowing exact details I guess, that "internal" in C# is primary a > > technical thing, that allows a compiler further optimizations, because he > > definitely knows, that the function/method is only used within the > assembly > > and is not required to do anything to expose it to the outside? > > > > > Regardless of the technical details, it is still a fine way of applying > encaptulation so you can't say that it is only a technical thing. > > > > > > > > > > * In response to the argument that php already has accessibility > > > restrictions with private and protected: > > > This is true, but it does not solve all problems. Often you need > classes > > > to interoperate in a way that can only be facilitated by making > > > functionality public. Also, there is no way to make a private or > > protected > > > class (since php has no assembly concept), though what I propose would > > > likely birth the concept of private and protected classes as well. > > > > > > > Maybe it's just me, but no: I've never had the need of what you describe > > and where a public method wasn't apropriate anway... At least for a very > > long time :D > > > > > > > > > > * In response to the argument that PHP does not restrict anyone from > > > adding to a namespace: > > > That is true, but say you were using Doctrine2. Would you ever make a > php > > > file with "namespace Doctrine2;" in it, unless you wanted to modify > > > Doctrine2, and hence you knew what you were doing, or accepted the > risks? > > > > > > > Well, yes. But extending/overriding a components method _always_ > requires, > > that you know what you do, so why enforcing/encouraging hacks, instead of > > the good old "protected"? > > > > > "Protected" is used for extending classes. There is no mechanism to inherit > and extend a namespace so "protected" is irrelevant here. > > > > > > > > > > * In response to the concept of solving this through documentation: > > > First off, this is not possible with the current phpdoc and phpdoc2 > > > standards. Second off, problems like these should not be solved by > > > documentation, imho, or of course I would not propose this. The C# > > > designers seem to agree with me. And the Java designers, too (though > they > > > have no internal keyword they do have a way of hiding framework > specific > > > classes). > > > > > > > > Actually Java has a concept that is identical to your proposal. The default > access modifier (when no access modifier is written) is the "package" > modifier (=accessible from within the same package). > > Ha, it's been years since I'm asking for such a feature to come to PHP. I would love to see a package visibility in PHP, restricting access to 'package'ed members (methods or attributes) to an object born from a class of the same namespace. Would really help some cases in frameworks or so :-) Just my2cents Julien --f46d043bdf9ec2afad04d6db1514--