On 12/26/2017 5:20 PM, Alexander Lisachenko wrote:
> In some distant future it could be implemented in more natural way with
> classes for primitive types and automatic boxing/unboxing for primitive
> built-in types:
> 
> Php\Type\Object
> Php\Type\Scalar
>    ⌊ Php\Type\String
>    ⌊ Php\Type\Integer
>    ⌊ Php\Type\Float
>    ⌊ Php\Type\Boolean
> Php\Type\Array
> 
> And it will be easy to typehint all scalars via common parent class:
> 
> public function acceptsScalar(Scalar $scalarValue).
> 
> But all scalar objects in this case should be implemented as immutable or
> should be passed as copy (like arrays). So, I would vote no for adding
> special scalar typehint without mapping it to the common class or
> interface, like iterable => Traversable, callable => Closure, etc
> 
> Best regards, Alexander
> 

This is what I would like to see but making the primitives objects
without too much BC is a complicated thing to achieve. Auto-boxing could
be a solution. However, we would need many new things and new things are
in general not well received in the PHP world if they replace other things.

-- 
Richard "Fleshgrinder" Fussenegger

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

Reply via email to