Hi! > It's also impossible to write a PHP class with "internal state" - state > that I can't find at run-time with reflection. That's what makes the > language reflective. Internal state in this sense is something foreign > to PHP as well, the only exception being things like resources, but > those aren't really types in the first place, but handles to file-system > objects, representing state outside of the program.
It's not foreign to PHP, it's unavailable to userspace, yes. Internal functions have access to more capabilities than userspace ones, it has always been the case in PHP. > We're talking about a simple object representing an integer timestamp > and a timezone ID. There is no logical reason those should be hidden - > it's just an implementation detail showing up as an artifact. There is a reason, or rather reasons, one of them is that internal representation of the data and user-visible one are different. What is inside the object is not what you see on the outside. > You're describing implementation details - these are features of C, not > features of the PHP language, they happen to leak into the into the PHP > language where they present themselves as inconsistencies. You can call it whatever name you like, I'm just explaining how it actually works :) Calling everything you don't understand "inconsistencies" seems to be new fashion, but the fact is internal API has more capabilities than user-space API in PHP. It is a deliberate and very old decision stemming from the fact that it is very hard - impossible, really - to give user-space access to engine features safely to PHP code. OTOH, some interesting things only possible if you have access to these features. > The fact is that DateTime does not behave like a PHP class in terms of > reflection. It behaves like internal PHP class. You can't really expose state of internal classes via reflection, since in general case this state does not have proper representation in PHP terms besides that very class itself. -- Stas Malyshev smalys...@gmail.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php