Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82314 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 27584 invoked from network); 9 Feb 2015 19:52:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Feb 2015 19:52:51 -0000 Authentication-Results: pb1.pair.com header.from=lester@lsces.co.uk; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=lester@lsces.co.uk; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lsces.co.uk from 217.147.176.214 cause and error) X-PHP-List-Original-Sender: lester@lsces.co.uk X-Host-Fingerprint: 217.147.176.214 mail4-2.serversure.net Linux 2.6 Received: from [217.147.176.214] ([217.147.176.214:38713] helo=mail4.serversure.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5B/36-25034-11019D45 for ; Mon, 09 Feb 2015 14:52:50 -0500 Received: (qmail 14992 invoked by uid 89); 9 Feb 2015 19:52:47 -0000 Received: by simscan 1.3.1 ppid: 14986, pid: 14989, t: 0.0785s scanners: attach: 1.3.1 clamav: 0.96/m:52/d:10677 Received: from unknown (HELO ?10.0.0.8?) (lester@rainbowdigitalmedia.org.uk@86.189.147.37) by mail4.serversure.net with ESMTPA; 9 Feb 2015 19:52:47 -0000 Message-ID: <54D9100E.6070404@lsces.co.uk> Date: Mon, 09 Feb 2015 19:52:46 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: PHP Internals Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Design by Contract and scalar types ... From: lester@lsces.co.uk (Lester Caine) May as well do something practical while I am testing ... http://php7.lsces.org.uk/wiki/view/The+good+old+days+...+annotation+without+overheads First thing to pick up ... PHP7 is a good 20% faster than the current PHP5.6.5 but I'm seeing no speed difference between 5.6.5 and 5.4.20, so as long as can leapfrog the remaining PHP5.x builds then all of the time upgrading TO 5.4 is not a waste. But the main reason for posting this was the recent comments that strict types has nothing to do with annotation. It was EVERYTHING to do with annotation and project design. Every value I pass to the verify function has to be validated for much more than just integer or string, so how do I pass the correct information for this single function. content_id would have been a 32bit integer in the 90's, but the upgrade of SQL sequences to 64bit has changed that. user id's are still 32bit integers, and create and edit are timestamps which are another contentious area when trying to work cross database. Mine are 32bit day + 32bit time, so a pair of current integers, but stored as a 64bit value in the database. title is a 250 character string, and while ip is v4 at present v6 needs to be catered for in PHP7. I see nowhere here that a few limited strict tags provides any help, but every value passed currently will need additional code if the integer checking becomes an unconstrained object. Much has been made of adding a class string to handle all the extra unicode processing, but I am now thinking that a properly exposed string and integer class which has the ability to assign constraint checks does make sense. Then use of an integer value on a 32bit platform can error when the actual value is too big for the target use. THAT is what strict type checking is about! -- 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