Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87094 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 41422 invoked from network); 10 Jul 2015 05:00:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Jul 2015 05:00:25 -0000 Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.50 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.192.50 mail-qg0-f50.google.com Received: from [209.85.192.50] ([209.85.192.50:33605] helo=mail-qg0-f50.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2A/87-22102-7615F955 for ; Fri, 10 Jul 2015 01:00:24 -0400 Received: by qgef3 with SMTP id f3so74975488qge.0 for ; Thu, 09 Jul 2015 22:00:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Jdz6071C9PJ75cCAf89ZYdP9125Qw00JadvEiRgMf24=; b=L2E4IU2J2jqUdDpF9gASNYjplyhrsEAQP3IyoFb1GuZ+VGJlrcRZUMAzEfjh4oSSjJ 9aYmjfq/zdMLpFLTkWVTYMtWQ24HD6pMAwiUSf6/nuuDrlGQZQdHcALZd78WxMkZad+D Shrr6FITxbay/pZXA29squrfQcOZauqngg25u7tjwcMgom3t3YWh7oM8EJabyALBqRlz jX82kNFoaFOgM6w+hVbYCBUfbn7E0RnVnyA4VrpmhoohDK8AL9Yk8sM7GIMvqZpsoLql JSZ7YH7sarIkIo/UbSraoBc+nfvHzU46infe58lZw9OFdAkybjjshuyO2AQ4d4BPEq4/ lnDw== MIME-Version: 1.0 X-Received: by 10.140.148.72 with SMTP id 69mr31558302qhu.15.1436504420742; Thu, 09 Jul 2015 22:00:20 -0700 (PDT) Received: by 10.96.154.195 with HTTP; Thu, 9 Jul 2015 22:00:20 -0700 (PDT) In-Reply-To: References: <559D7DE1.8000603@gmail.com> Date: Fri, 10 Jul 2015 12:00:20 +0700 Message-ID: To: Philip Hofstetter Cc: Stanislav Malyshev , Net Mo , PHP internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Change IntlChar::getNumericValue() to return something less horrible when the char is not numeric? From: pierre.php@gmail.com (Pierre Joye) On Thu, Jul 9, 2015 at 2:09 PM, Philip Hofstetter wrote: > Hi > > On Wed, Jul 8, 2015 at 9:45 PM, Stanislav Malyshev wrote: >>> I would change the function to return NULL instead; what do you think? >> >> While the exact value of U_NO_NUMERIC_VALUE looks weird, nobody is going >> to use it directly, you'd be using U_NO_NUMERIC_VALUE. Comparing to it >> doesn't look wrong. So changing that to null doesn't seem to improve >> much, just introduce incompatibility with ICU. > > personally, I think null (or even false) is better because it's of a > different type (and falsy) and thus more likely to get noticed that > something is wrong. In PHP, you're used to checking for null or false. > > Having to deal with values that look like they are within valid ranges > and which also validate to something true-ish is needlessly difficult > and unexpected. > > The unicode standard apparently wants to use NaN, so ICU is already > deviating from the standard. Right. As I prefer APIs matching PHP common APIs signature the intl extension followed another goal or design. It matches ICU APIs as much as possible to make it easy to learn for people already using in other languages. To me this goal made sense back then. However I do not know many users actually using ICU in other languages. I am not a fan of the current situation but changing one part or another to better fit PHP will be inconsistent. I am all for a more PHP friendly API tho'. We failed to have so far, uString bailed out and other attempts did not even remotely get a consensus. But I still have hope to get something better for the core unicode features. Cheers, -- Pierre @pierrejoye | http://www.libgd.org