Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86099 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 76711 invoked from network); 30 Apr 2015 17:10:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Apr 2015 17:10:53 -0000 Authentication-Results: pb1.pair.com smtp.mail=walterp@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=walterp@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.179 as permitted sender) X-PHP-List-Original-Sender: walterp@gmail.com X-Host-Fingerprint: 209.85.212.179 mail-wi0-f179.google.com Received: from [209.85.212.179] ([209.85.212.179:34993] helo=mail-wi0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7B/10-10478-C1262455 for ; Thu, 30 Apr 2015 13:10:53 -0400 Received: by widdi4 with SMTP id di4so27768242wid.0 for ; Thu, 30 Apr 2015 10:10:49 -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=tcKGCF1xyuKl+TJVBZixIRTKy2eHDFUm59XYJCrDQcA=; b=TqAnIZ7ZTICi2R1/0R3fyy27tFqv77Ls6384fFUGG16rpGExgi4l7vz7PjJwZt54Ql xCyFrZfDk3FuhQjQnSQaS6gKKL4cSAHO2oQHXdrAlLaEXy1DnqHWK4frQ3stD6ZG+GKs Ku+uWCu5dwcUvIRafF0x0kns+uX/B5RTKobQeyWeWRzPq3g0GCd5WRp7ywlCqY6JplDg q0MPFwukfS1oKGOJ85Birel6KNczRNzCzEOv0wwbVFldYUO/vB9AU535IwsBiNTr/nIN HpJaTb04/pKAOZauvfA1GgMpobLqDAwUkGIJluex0gKCNe+47pRMclG76oDE6pRp7tJq ohNA== MIME-Version: 1.0 X-Received: by 10.194.235.71 with SMTP id uk7mr10515858wjc.13.1430413849640; Thu, 30 Apr 2015 10:10:49 -0700 (PDT) Received: by 10.27.227.11 with HTTP; Thu, 30 Apr 2015 10:10:49 -0700 (PDT) In-Reply-To: References: Date: Thu, 30 Apr 2015 10:10:49 -0700 Message-ID: To: Levi Morrison Cc: Yasuo Ohgaki , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=089e01493afa63c4a90514f42d8b Subject: Re: [PHP-DEV] Adding "numeric" type hint From: walterp@gmail.com (Walter Parker) --089e01493afa63c4a90514f42d8b Content-Type: text/plain; charset=UTF-8 On Thu, Apr 30, 2015 at 7:35 AM, Levi Morrison wrote: > This numeric type is a type of int or float. There is a formal name > for such types: union types. Some languages have syntax for union > types that would look like this: int | float. I have a draft RFC for > this subject: https://wiki.php.net/rfc/union_types. Union types would > be useful for other common cases as well, such as `Foo | null` or > `array | Traversable`. > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > Yes, this a union type. As I understand the request, the union type definition would look like int|float| string where is_numeric(string) is true. According to the definition of is_numeric, it does not check to see if the string can be cast into an int or float, only that it could parsed an stuffed into a bignum or GMP object. Walter -- The greatest dangers to liberty lurk in insidious encroachment by men of zeal, well-meaning but without understanding. -- Justice Louis D. Brandeis --089e01493afa63c4a90514f42d8b--