Re: Re: [RFC] [PRE-VOTE] Union types

From: Date: Sat, 04 Jun 2016 22:59:35 +0000
Subject: Re: Re: [RFC] [PRE-VOTE] Union types
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-93793@lists.php.net to get a copy of this message
> Am 05.06.2016 um 00:55 schrieb Andrea Faulds <ajf@ajf.me>: > > Hi again, > > In an attempt to be constructive, I have implemented an alternative approach to weak scalar > type selection here: > > > https://github.com/krakjoe/php-src/compare/multi-types...TazeTSchnitzel:multi-types-roulette > > 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. > > 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. > > Please tell me your thoughts! > > -- > Andrea Faulds > https://ajf.me/ > <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

« previous php.internals (#93793) next »