Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101427 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44324 invoked from network); 26 Dec 2017 22:39:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Dec 2017 22:39:54 -0000 Authentication-Results: pb1.pair.com header.from=php@fleshgrinder.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=php@fleshgrinder.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fleshgrinder.com from 212.232.28.122 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 212.232.28.122 mx201.easyname.com Received: from [212.232.28.122] ([212.232.28.122:38706] helo=mx201.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AA/07-58518-8BFC24A5 for ; Tue, 26 Dec 2017 17:39:53 -0500 Received: from cable-81-173-135-181.netcologne.de ([81.173.135.181] helo=[192.168.178.20]) by mx.easyname.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1eTxsy-0002Ry-2e; Tue, 26 Dec 2017 22:39:49 +0000 Reply-To: internals@lists.php.net To: Alexander Lisachenko , Andreas Heigl Cc: PHP internals list References: <72392123-d37b-26df-6886-218f48205f8a@fleshgrinder.com> <5171148a-3554-35a3-ab72-370e1aac4a3f@php.net> <88921EA7-EB68-4630-AA9E-DE0C04342F0B@heigl.org> Message-ID: <0c570b60-237b-5bc5-c251-bc938c13b1e9@fleshgrinder.com> Date: Tue, 26 Dec 2017 23:39:45 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-DNSBL-BARRACUDACENTRAL: YES X-DNSBL-PBLSPAMHAUS: YES X-DNSBL-SPAMRATS: YES Subject: Re: [PHP-DEV] [RFC] [DISCUSSION] Scalar Pseudo-type From: php@fleshgrinder.com (Fleshgrinder) 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