On 05/06/16 11:56, Fleshgrinder wrote:
> Quick sketch of a ReflectionVariable class:
> 
> https://gist.github.com/Fleshgrinder/40d256a4bf44a0e2579b41d6e92e976e
> 
> What do you think?
> 
> PS: This would definitely be a different RFC!

The one thing that sticks out from this is 'why do I need all this?'

This may be because I don't understand just what happens under the hood
when you create a $var and in my naive way I have ALWAYS assumed that a
variable was a set of data elements with a pointer which 'a single
compiled and optimized set of code' operated each of to provide either
the raw value, or transformed version of that data essentially in a
different type. but if the value was provided as a string, that string
was maintained.

I've never viewed a $var as a single data element, so 'typing' it as int
does not mean that it only exists as a fixed length register - probably
64bit - with no other versions stored. If it was provided as a hex
string then I would anticipate that both the hex string type will exist
in parallel with the binary value. At least a $var has a name field,
flags for access restrictions, and yes null fields where they have not
be defined.

I would expect ALL of the extras listed in 'ReflectionVariable' simply
to be core code handling any $var value be that as an element of an
enclosing array, a property in a class, or a parameter in a function
call. This is why I don't understand the 'strict' mode at all. Or rather
I do in relation to a compiled language that does not have the
flexibility to pass data from one domain to another and where the typing
is directed to specific hardware restrictions which then make optimizing
code appropriate, but PHP specifically avoids that problem. It was the
major plus when I started using it! I understand that type checking has
a place, but NOT as it is currently structured, which is why I think all
the current round robins on typing/null/strict are simply going to carry
on in that manor.

When I create 100 person objects how many copies of the class and
related code are created? Is each property then it's own full copy of
the var code, which is why you want to 'optimise' for each different
type, rather than improving the caching of the objects data to only run
a type conversion when it is needed.

-- 
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

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

Reply via email to