Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92569 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99854 invoked from network); 20 Apr 2016 19:56:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Apr 2016 19:56:47 -0000 Authentication-Results: pb1.pair.com header.from=guilhermeblanco@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=guilhermeblanco@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.223.170 as permitted sender) X-PHP-List-Original-Sender: guilhermeblanco@gmail.com X-Host-Fingerprint: 209.85.223.170 mail-io0-f170.google.com Received: from [209.85.223.170] ([209.85.223.170:33801] helo=mail-io0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 86/05-14036-EFED7175 for ; Wed, 20 Apr 2016 15:56:46 -0400 Received: by mail-io0-f170.google.com with SMTP id 2so64079163ioy.1 for ; Wed, 20 Apr 2016 12:56:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=tHLnzXgXmxnT17oFoVbx5MHfuZ65H0jxOWlfGs6R7aI=; b=qXYStrgE6RM9Mo/Bxgm2s7ypxgD4G119RnV2kR4GqtbMj2unbRZN0Q1J2sPIBBu0Ck jihQxTLm/BBB/KqWAX62htgxNKOM1cKu0KdqSYiuw/+737Wpvr4Ug3+/hWZOdqFikgYz +7QN23MMkGrymTp5hTmGabHtihynD4jzkWHjLlR04JNJcVJuh/PSG8gLTu3nc7Egh/59 qK3XofmE9r2gSDnFXyW5Ai2c9CpqHX4tFhKObEH/WoLcYv4uOSAXNxA6ktNtrcH4Qo8b CujGHRCmWirxEJ0R8r2RHjL5B2bQhRxgHU86jYPjCogI2k04xgIgJHerYFciwQkrH1DW 7CiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=tHLnzXgXmxnT17oFoVbx5MHfuZ65H0jxOWlfGs6R7aI=; b=kgBXJybGSnYQcLuQ3Zq2kEJq2aFgvS2T0/gBeyt8gwj/mM6M2bD77J70VJ4ax+oTEW MBkab221S7hGA1tKNPDMkXya7fwfagW2cieHJQ1ujhFzjHZx6GZSpRl6WnwwXx3yqyn5 T1khqmoBan5OrU2y2jVAVoN0O++LQVPRje9kTHaqjDJFMtPcNKod4tJKmxpKnoD9omMa c3wbanu2OG0VlWbrTBPWzH+21YYjXWJ8gyzgpatwimGz59PuzxgJdRDkWwkiDctasxYu Tztl51pr+BI4gwKv2QjD451DNDEL/qrp10kfy0z2hjW9kMNS8zlQOWDyE/LMzS+vZgw9 ePiA== X-Gm-Message-State: AOPr4FVZdY1D9jsrUOTLC81dABiPQ3vhG2zSZbjaXeHZlI072l97eVq3a/kh2X9WjW6NL4Vh6O4OXTIF1Zg03g== X-Received: by 10.107.148.210 with SMTP id w201mr12177920iod.63.1461182203716; Wed, 20 Apr 2016 12:56:43 -0700 (PDT) MIME-Version: 1.0 Received: by 10.50.85.10 with HTTP; Wed, 20 Apr 2016 12:56:24 -0700 (PDT) In-Reply-To: <5717D70E.5010706@lsces.co.uk> References: <5717D70E.5010706@lsces.co.uk> Date: Wed, 20 Apr 2016 15:56:24 -0400 Message-ID: To: Lester Caine Cc: internals Content-Type: multipart/alternative; boundary=001a113fd402347a190530effe54 Subject: Re: [PHP-DEV] Quick sanity check ... From: guilhermeblanco@gmail.com ("guilhermeblanco@gmail.com") --001a113fd402347a190530effe54 Content-Type: text/plain; charset=UTF-8 I might answer you by given a scenario that happened this week here at work. Because our non-broken language relies on a loose type system, a developer of my company wrote a property that accepts null, int, string, object, whatever as a property. This property was declared in a class that is used in a console command that runs weekly. This property was supposed to hold an integer (value in hours) that would calculate a difference in time and cancel prospected purchases older than this variable hours. All unit tests passed, because they inspect the parts not the whole. By mistake, the developer forgot to provide a value. Nothing was reported in PHP because the language is not broken, and because there's no final and no typed property, no error was reported and code proceed execution. That value that was not initialized and got assigned as null. This value was then converted to 0, and all purchases older than "now - 0 hours" got cancelled. The outcome is easy to grasp. Because it did not crash by a TypeError (which would also require the file to be declared as strict), and we lost 100k in sales. But PHP does not need more strictness... Regards, On Wed, Apr 20, 2016 at 3:22 PM, Lester Caine wrote: > With all of the debate on the 'type system', can I just ask a probably > silly question ;) > > I'm currently working on porting an application that has been running on > windows as C++ code for 20 years. The main reason for changing is that > While it worked fine when sites upgraded to XP, the move to W7 and later > really needs all the code recompiled, something that will need a big > cheque book to buy a current compiler set. So for many reasons a switch > to web based using already existing tools makes perfect sense. > > The database is still running Firebird since the switch from interbase > in the late 90's so all of the existing data can be maintained, and I > already have a working base on which to build a new set of page > templates. ( Only hole is the need for a decent javascript scheduler > function to replace the desktop one :( ) > > This is all running on SQL based schema's which have not changed in > years, and ADOdb still quite happily produces arrays of results for > which there is little point creating new 'objects', just simply handling > the basic variable entries in the arrays just as I have for years. The > various tools handle data validation, and 'null' is an essential > component of that validation process. This does not need any of the > overload of creating 'getters and setters' and I see little point trying > to add any 'type' casting into the process since the validation layer > simply works with the bog standard variables without and need for > 'special cases'. > > So what benefit does all of the additional 'facilities' now being piled > on give that would actually improve that process. I am now seeing a > speed improvement on the PHP7 ports, but I'm not seeing any point to > make any changes to code OTHER than making the PHP5.2 code clean on PHP7 > ... As Zeev has already said "PHP is not broken" ... Do I really need to > change the way I work which is running fine for my clients? > > -- > Lester Caine - G8HFL > ----------------------------- > Contact - http://lsces.co.uk/wiki/?page=contact > L.S.Caine Electronic Services - http://lsces.co.uk > EnquirySolve - http://enquirysolve.com/ > Model Engineers Digital Workshop - http://medw.co.uk > Rainbow Digital Media - http://rainbowdigitalmedia.co.uk > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Guilherme Blanco Lead Architect at E-Block --001a113fd402347a190530effe54--