On Wed, 27 Feb 2013 11:07:06 +0400, Jens Riisom Schultz <ibmu...@me.com> wrote:

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.

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


Hi,
I, for one, think it should be solved on the IDE side. I used a lot of Doctrine's internal methods lately and if they would be not accessible I wouldn't be able to do a lot of things. Of course internal methods/classes shouldn't be exposed as a part of API, but if they exist, I would want to call them *if I know what I'm doing*. I think it would be useful if phpdoc had an @internal tag so that IDEs could highlight places where you use internal parts of library.

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to