Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93793 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26256 invoked from network); 4 Jun 2016 22:59:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Jun 2016 22:59:42 -0000 Authentication-Results: pb1.pair.com header.from=bobwei9@hotmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=bobwei9@hotmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain hotmail.com designates 65.55.111.169 as permitted sender) X-PHP-List-Original-Sender: bobwei9@hotmail.com X-Host-Fingerprint: 65.55.111.169 blu004-omc4s30.hotmail.com Received: from [65.55.111.169] ([65.55.111.169:58145] helo=BLU004-OMC4S30.hotmail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A9/3F-25194-E5D53575 for ; Sat, 04 Jun 2016 18:59:42 -0400 Received: from BLU437-SMTP77 ([65.55.111.136]) by BLU004-OMC4S30.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Sat, 4 Jun 2016 15:59:40 -0700 X-TMN: [LZxdYr2S2LDpixN2vo0aAQdr8r/NjwMf] X-Originating-Email: [bobwei9@hotmail.com] Message-ID: Content-Type: multipart/alternative; boundary="Apple-Mail=_7CF324C8-121A-4029-A2DE-337F517B9634" MIME-Version: 1.0 (Mac OS X Mail 9.2 \(3112\)) In-Reply-To: <6B.DE.25194.C5C53575@pb1.pair.com> Date: Sun, 5 Jun 2016 00:59:35 +0200 CC: internals@lists.php.net References: <0A.C5.62101.1C860575@pb1.pair.com> <9A.32.22497.9AE91575@pb1.pair.com> <6B.DE.25194.C5C53575@pb1.pair.com> To: Andrea Faulds X-Mailer: Apple Mail (2.3112) X-OriginalArrivalTime: 04 Jun 2016 22:59:37.0723 (UTC) FILETIME=[C4E5A4B0:01D1BEB4] Subject: Re: [PHP-DEV] Re: [RFC] [PRE-VOTE] Union types From: bobwei9@hotmail.com (Bob Weinand) --Apple-Mail=_7CF324C8-121A-4029-A2DE-337F517B9634 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="us-ascii" > Am 05.06.2016 um 00:55 schrieb Andrea Faulds : >=20 > Hi again, >=20 > In an attempt to be constructive, I have implemented an alternative = approach to weak scalar type selection here: >=20 > = https://github.com/krakjoe/php-src/compare/multi-types...TazeTSchnitzel:mu= lti-types-roulette >=20 > Where there is no exact scalar type match, this patch uses an = algorithm originally suggested by Nikita, wherein we use rand() to pick = which type to cast to. >=20 > This is much simpler than having a type precedence matrix, and thus is = easier to remember and reason about. The choice of selection function = means that no particular use-case is privileged. Given PHP's scalar = types are roughly equivalent (after all, PHP juggles them freely), this = apparently unorthodox selection process should nonetheless produce = sensible results in most cases. >=20 > Please tell me your thoughts! >=20 > --=20 > Andrea Faulds > https://ajf.me/ This is the holy grail I was hunting for so long! All my computational problems can be solved by a simple rand()! In case nobody objects I'm going to merge that straight ahead into = php-src 7.0 (no need for master-only, after all it's no real BC break!). Thanks a very much!!! Bob= --Apple-Mail=_7CF324C8-121A-4029-A2DE-337F517B9634--