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

From: Date: Sat, 04 Jun 2016 22:55:20 +0000
Subject: Re: Re: [RFC] [PRE-VOTE] Union types
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-93791@lists.php.net to get a copy of this message
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/

« previous php.internals (#93791) next »