>
> > thank you! It is a useful feature to me.
> >
> > class MyBitmask {
> >       const POS_1 = 1;
> > //    const POS_2 = 2;        // reserved/undefined
> > //    const POS_3 = 3;        // reserved/undefined
> >       const POS_4 = 4;
>
> I'm developing software with PHP since version 2 and i'm still easily
> impressed by such code. So we need get_object_constants and
> get_class_constants for such fancy stuff?
>
> Where's the good old
> $flag == true; or FLAG == true;?
>
> A bitmask class to shuffle around with class constants using reflection
> of itself and a magic method get_class_constants to check a boolean flag?
>
> I just don't get it but maybe i'm to focused to doing things the most
> simple and readable/maintainable way.
>

The simple case of things like this is to be able to read extended classes;
say you are enforcing some type of bitmask checking; well extended classes
may not have the same signature.  Bitmasks are nothing new; PHP uses
several of them internally and several of them inside of various functions
(generally a bitmask would look more like:
00000 = 0
00001 = 1
00010 = 2
00100 = 4
01000 = 8
10000 = 16


>
> Maybe, in a few years, c++ will be a beginners language compared to PHP
> which gets added new shiny features every day which will only be used by
> even more shiny frameworks and the most shiniest, bloated objects one
> can imagine.
>
> With every fancy feature added to PHP you kill a kitten!
>

This is not necessarily a new feature; it's simply rounding out some of the
already existing functions.  We're not talking about new "framework"
features; we are talking about ways to get things done quicker (although
the fractions of microseconds don't made a huge difference).  If you think
this is a new fancy feature; you likely think that this is the shiniest:
$class = new Reflection('MyClass');
$constants = $class->getConstants();

I'm more with this "Give PHP and it's core developers a rest" so that
> the core can be improved/cleaned up instead of adding Java features
> people have seen on the university and like them but now they're forced
> to use PHP which is like the opposite of Java. Java has it's good
> reasons too. Just a tool. Use the tool that fits best, don't use the
> hammer as a saw by adding teeth to it.
>

Funny enough; this is more PHP like than Java; the Reflection class is more
java oriented and already exists and is not touched in this.  We're talking
about global functions.  Sure give PHP a rest; but you know... I was
raising this simply for consistency; speed.  I am not asking anyone else to
work on this; hell part of the reason I submitted the PR before even
writing an RFC.

I am simply suggesting an alternative to using Reflection whereas:

get_class_constants([object|string]);
get_object_constants([object]);

Do we need both; probably not; the first would likely do.

Reply via email to