Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:66265 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 50129 invoked from network); 27 Feb 2013 09:12:17 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Feb 2013 09:12:17 -0000 Authentication-Results: pb1.pair.com header.from=linepogl@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=linepogl@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.219.50 as permitted sender) X-PHP-List-Original-Sender: linepogl@gmail.com X-Host-Fingerprint: 209.85.219.50 mail-oa0-f50.google.com Received: from [209.85.219.50] ([209.85.219.50:51210] helo=mail-oa0-f50.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 95/00-49561-0FDCD215 for ; Wed, 27 Feb 2013 04:12:16 -0500 Received: by mail-oa0-f50.google.com with SMTP id l20so680948oag.9 for ; Wed, 27 Feb 2013 01:12:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=NI4Vr6hsITSpf/QnbRxnuRTwTjS9Ni3JDXRr+/N8ubg=; b=0/7dsL5ZbwWiYpzFYa0OWPzB14Z/JfeVDk4Kli3jW9bKiPmcXjEzPwABuYvZ2xoGvC 8J3iQHF03QYjYXcJxXxcRGgyKdPJFzB676f2YlpeeJ4vH85k32cihB7tsXbDQwA9fo8j hmcMFwNgK513HWxFYY/s4qm5R3ckUCK9UFLQ4ZiACE4EUKEXaQ+IhtvubtXfvntRA97U QiH4+GXCnvbmJGOGUd/n5mxA23SjF+EzFNM7jYVFo3n3hs64VKz9jBMSUhbsArKfRUL2 NMwghIGokFkkhZN9jPVelS37byaC87JA4tlhHaQ5Su1cK5yJhoZywjNHUU8OmiFhQv11 fi7w== X-Received: by 10.60.25.35 with SMTP id z3mr1297958oef.98.1361956333562; Wed, 27 Feb 2013 01:12:13 -0800 (PST) MIME-Version: 1.0 Received: by 10.76.167.202 with HTTP; Wed, 27 Feb 2013 01:11:53 -0800 (PST) In-Reply-To: References: Date: Wed, 27 Feb 2013 10:11:53 +0100 Message-ID: To: Jens Riisom Schultz Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=e89a8f923cfe7637b204d6b12bde Subject: Re: [PHP-DEV] I would like to write an RFC for the addition of an internal keyword From: linepogl@gmail.com (Lazare Inepologlou) --e89a8f923cfe7637b204d6b12bde Content-Type: text/plain; charset=UTF-8 Hello, 2013/2/27 Jens Riisom Schultz > Hi, > > I just want to get a feel for whether the following idea would be > instantly rejected (for example I get the feeling that adding keywords is a > big deal): > > Often, when writing frameworks, you need to make public or protected > functionality or classes which should only be called from inside the > framework. You CAN ensure this with a lot of ninja tricks and > debug_backtrace, but it is very cumbersome and often hides your methods and > properties from class signatures. > > Therefore I would propose adding a C# style "internal" keyword. ( > http://msdn.microsoft.com/en-us/library/7c5ka91b(v=vs.80).aspx ) > > The idea is, simply, that functions, methods and classes marked as > "internal" would only be accessible from within the namespace in which they > are defined. > > The "internal" keyword in C# restricts access to the same *assembly*. An assebly in .NET jargon is a .dll or a .exe, ie a package of code compiled by the same developper at once. As packages in PHP do not exist, or exist in some vague form (.phar, composer etc), I do not see how this keyword, with its original meaning, could find a place here. Namespaces are not restricted to the same develloper and anyone can add to them. Therefore, the meaning of the keyword would be totally different from that of C#. > For example the following class, "namespace Framework; internal class > Something {}", would only be visible from within the "Framework" namespace. > > I have a hunch that this would be relatively easy to implement. > > If noone objects I would attempt to create a patch and an RFC. > > What do you think? > > > -Jens Riisom Schultz > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --e89a8f923cfe7637b204d6b12bde--