Hello,

2013/2/27 Jens Riisom Schultz <ibmu...@me.com>

> 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
>
>

Reply via email to