Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86080 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15671 invoked from network); 30 Apr 2015 07:42:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Apr 2015 07:42:54 -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:33560] helo=mail-wg0-f47.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 66/84-27026-EFCD1455 for ; Thu, 30 Apr 2015 03:42:54 -0400 Received: by wgin8 with SMTP id n8so52653055wgi.0 for ; Thu, 30 Apr 2015 00:42:50 -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=LGpfMjFMFsCUNEr6TiJlGB8w/Nu/In3Tog2ytXnipcE=; b=Bvvt+Az6JdE8QiMnJHGCZnGvo7Ib3Myu1EFOU6YMu6fb/bExwJCy6kT5dXvYOXzYWV g4WhT22+UCFg4leNbpS4vZ2aoSzA61gMIehsHSfO/gKrBt6PNC0ZCb9se53HOmvL+sv3 TCnfvVrTFaQp1Q9EKN8q2ZLnrGL4JmunU1AvYJDJJ7D7KA0AUqL4tB16A0t262Sc3uaU AnXvT4zv+JfkFjUIFG1z+T6HT2c7UFkHRJYaHImBge53yopSkM0FvNJSf3MY9DsPmrkW NxU13hit9KB+pAqqdBwgltczDFBbrySW8Z177jpSKpptwXltpfa99Yi/2mR6Yo7k+IPe F4kg== MIME-Version: 1.0 X-Received: by 10.180.98.97 with SMTP id eh1mr3007483wib.11.1430379770862; Thu, 30 Apr 2015 00:42:50 -0700 (PDT) Received: by 10.27.227.11 with HTTP; Thu, 30 Apr 2015 00:42:50 -0700 (PDT) In-Reply-To: References: <55401F31.9030703@gmail.com> <55416849.9010808@gmail.com> <554176D6.2030007@gmx.de> <55418CBE.6050609@gmail.com> Date: Thu, 30 Apr 2015 00:42:50 -0700 Message-ID: To: Yasuo Ohgaki Cc: PHP Internals Content-Type: multipart/alternative; boundary=f46d04428cdc22e3e60514ec3e57 Subject: Re: [PHP-DEV] Adding "numeric" type hint From: walterp@gmail.com (Walter Parker) --f46d04428cdc22e3e60514ec3e57 Content-Type: text/plain; charset=UTF-8 On Thu, Apr 30, 2015 at 12:06 AM, Yasuo Ohgaki wrote: > Hi Walter, > > On Thu, Apr 30, 2015 at 3:54 PM, Walter Parker wrote: > >> You didn't answer the question: why should we care? Is there enough of >> user base now to care? IOT might be able to run PHP, but how many actually >> do? And of the ones that do, is automatically half fixing the code that bad >> programmers might write for the last remaining 32 bit platforms a good use >> of our time? >> >> > I don't suppose anyone objects view that IoT will be a big market in near > future. > The main problem is not only code IoT developers write, but libraries used > by them. > If you know embedded devices, they care every single dollar costs. I don't > see > any reason that they use 64 bit CPUs while 32 bit CPU is enough. > > We may say using PHP and it's library is not safe, so don't use it. > I just don't like to say or anyone else say this. > > >> I don't see the numeric type as fixing any of these problems... >> > > Which is easier to advocate? > - Use "string" type hints for record ID/etc and validate value by > yourself. > - Use "numeric" type hints for record ID/etc. > or even > - Use _weak_ mode "int" type hints (If it's relaxed) > > Regards, > > -- > Yasuo Ohgaki > yohgaki@ohgaki.net > > I didn't says there wouldn't be big. I think they could be giant. What I said is that I think you are trying to solve a 1% edge problem that might not be much of an issue when the are bigger problems and better solutions. In an IOT where cost matter, using PHP is usually a poor design decision. There are better languages. If costs matter, use the proper language for this sort of environment (or use PHP correctly). I do not accept the argument that we must use 32 bit CPUs and 32 bit PHP, but then go and use a 64 bit DB. Use a 32 bit DB, or restrict your self to 31 bit keys (or just use strings). How many IOT systems use a language like PHP and not some simplified system (picoBasic, microJava). I've worked on embedded systems. When I worked with real world, cost sensitive systems, we used C, or a stripped down language. Not a language like PHP. Note, Android uses Davik (Java) or C/C++. iOS uses Objective-C, Windows Phone uses C#. All compiled languages with mostly static type systems that map to the type systems of the DB using a richer set of native types. PHP is not in a race to spread to any and all platforms, regardless of suitability. Let's use the right tools for the job. You do know that you that can control the schema of the DB. Have you suggested to SQLite that they make the default schemas PHP safe (instead of making PHP SQLite safe). Why should PHP dance to SQLite's tune rather than SQLite dancing to PHP's tune? I know this is a PHP mailing list, but PHP is not the end all, be all of programming languages and anybody programming IOT devices should know that. I'd prefer not to mess up PHP for its primary market while trying to fix side issues for secondary targets. I thing using string type hints are are easier to advocate (and I think they are the correct type if you need to be 32/64 indepentent). Otherwise, a numeric type doesn't fix the problem. It hides it. It is a short term that doesn't scale properly. Use int hints correctly. There are still new, if we start using the incorrectly, things will only get worse. Good night. -- The greatest dangers to liberty lurk in insidious encroachment by men of zeal, well-meaning but without understanding. -- Justice Louis D. Brandeis --f46d04428cdc22e3e60514ec3e57--