On 30/03/16 09:31, Dmitry Stogov wrote:
>>
>> I hope this makes some of these decisions clearer ...
> 
> One more thought about implicit initialization values. (int(0) for int
> instead of IS_UNDEF).
> I'm not sure if this RFC is going to be accepted yet, but lets think we
> will also implement type hinting for arrays.
> e.g. "array<int,int> $a[40];"  would create a packed array of integers
> with 40 elements.
> I would prefer to have all elements initialized by int(0) instead of
> IS_UNDEF.
> In this case we won't have to use zvals (and Buckets) for elements at
> all, and will able to narrow this type to native C array "long a[40];"
> This would safe 3/4 of memory required for array, and improve data
> locality.
> 
> Actually, this is exactly the same for properties.

This is defining a new packed array ... one that is not a PHP array?

I can understand the desire to compact data, but the place for that is
in code not in normal scripts. But my main objection is that making the
'new' default some type related value rather than 'NULL' is taking
things too far. The creation of a 'variable' precedes the
initialization, and the processing of an array of variables to then
populating from a database read or some other data source can be
completed by a step that identifies any 'uninitialised' data and actions
that appropriately ... or simply left as NULL.

OK I may be a dinosaur, but in my model of object orientated processing,
I create an object or array of objects and populate them or not as
required. Empty objects simply return that they are just that, and NULL
is the natural response converted to false as appropriate rather than
having to interpret '0' as different to some other integer ID. NOT
creating a container until there is something to put in it is a
completely different method of working, but that seems to be what is
being pushed as the 'proper way of doing things'?

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