Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86162 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 65956 invoked from network); 12 May 2015 02:25:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 May 2015 02:25:30 -0000 Authentication-Results: pb1.pair.com header.from=walterp@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=walterp@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.47 as permitted sender) X-PHP-List-Original-Sender: walterp@gmail.com X-Host-Fingerprint: 74.125.82.47 mail-wg0-f47.google.com Received: from [74.125.82.47] ([74.125.82.47:33754] helo=mail-wg0-f47.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BE/00-63606-79461555 for ; Mon, 11 May 2015 22:25:27 -0400 Received: by wgin8 with SMTP id n8so148505548wgi.0 for ; Mon, 11 May 2015 19:25:24 -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=2IZZ0fpwYBu/jcw1LontCgPCmQbzpiMH/vh0pqe+au4=; b=ba/Mfm5rLZMG4R3Utib9a21jM6jWi/A4gqoCYFJAmTbkkORckHKJ7E8jmDZ8U9mjVs 5/g6p0pScEq4TFRzepNUbkeq0gZXA3rUUG93Or3Xz2TH8grS1E9kEiuiois7UG0upL4C RfHkJRK8VxubQmlPlPyQvVUK7JmuvlfpdwqIexaOvnRWtdBeYbKT5m0yn+tj19CveB7j 9Q5W+0UylqB7XV4EB8/HGDqGFklP+wx618GWIgat6ZZPubjbX1YywlD5I9NG0RY4saiB AHdgIn/GgJBI2cWDh+6HM4NY1hYfL3xdUxbiCPmNHgrz0ENjUUIUdSPJXAgrfRbs3/oo 8Wcw== MIME-Version: 1.0 X-Received: by 10.180.73.230 with SMTP id o6mr893429wiv.11.1431397524771; Mon, 11 May 2015 19:25:24 -0700 (PDT) Received: by 10.27.227.11 with HTTP; Mon, 11 May 2015 19:25:24 -0700 (PDT) In-Reply-To: References: Date: Mon, 11 May 2015 19:25:24 -0700 Message-ID: To: Yasuo Ohgaki Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=f46d0435c018ff167d0515d93460 Subject: Re: [PHP-DEV] is_digits() and digits type From: walterp@gmail.com (Walter Parker) --f46d0435c018ff167d0515d93460 Content-Type: text/plain; charset=UTF-8 You know, given how worried you seem to be about this issue, could you booby trap your so that if the developers use the wrong type (int vs. string) the program throws fatal errors with nasty error messages that explain how much trouble the developer is in at the userland code level? While I like the of protecting idiot developers from themselves, I'm still not sure that this isn't a half solutions that just hide the pieces of the problem that it doesn't solve. I don't think we can solve the problem of developers not writing code correctly or QA would mostly be out of job (instead of being a growth segment). How about a full type system that would make Java programmer scream? I'm sure with a bit of thought we can make one heavier than Java. Walter On Mon, May 11, 2015 at 5:56 PM, Yasuo Ohgaki wrote: > Hi all, > > Firstly, I don't intend this for PHP 7.0 strictly. > > PHP is made for Web. It means PHP is made for interacting other > systems/data. Currently, we only have "int" and "float" strictly bounded > to native "unsigned int" and "IEEE 754 double". This causes problems > for interacting other systems/data. > > Conversion to native data type causes problem like RFC 7159 "6 Numbers" > points out. > https://tools.ietf.org/html/rfc7159 > PHP's "int" is more limited because safe value is least common and it's > signed 32 bit integer. > > > To resolve this issue, how about to have > > - is_digits() and digits type for digits only inputs(integer like string) > - is_numeric() and numeric type for float like string > > These check if variable contains only digits or float like string. > It's pseudo type, but it prevents developers to specify "int"/"float" type > wrongly. > These may be extended to allow GMP int/float. > > Having these make sense for a language made for interaction and make basic > type hint use intuitive. IMO. > > I wouldn't like to write too long mail. My thoughts and concerns are in my > blog > mostly. > > > http://blog.ohgaki.net/php7-is-going-to-be-strictly-typed-language-will-this-work > http://blog.ohgaki.net/dont-use-php7-type-hint-for-external-data > > Any comments? > > Regards, > > -- > Yasuo Ohgaki > yohgaki@ohgaki.net > -- The greatest dangers to liberty lurk in insidious encroachment by men of zeal, well-meaning but without understanding. -- Justice Louis D. Brandeis --f46d0435c018ff167d0515d93460--