Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82329 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88890 invoked from network); 10 Feb 2015 04:50:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Feb 2015 04:50:57 -0000 Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.220.173 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.173 mail-vc0-f173.google.com Received: from [209.85.220.173] ([209.85.220.173:35620] helo=mail-vc0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 56/D4-47508-03E89D45 for ; Mon, 09 Feb 2015 23:50:56 -0500 Received: by mail-vc0-f173.google.com with SMTP id hy4so6801240vcb.4 for ; Mon, 09 Feb 2015 20:50:54 -0800 (PST) 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:date :message-id:subject:from:to:cc:content-type; bh=YY9KqYxyf5YG+dg3kL9Dm2mHX6PESGIu9EMxrTVLkDs=; b=lqauf7cWxHN9mjJYjndhsvbMqU2mt7Q30tA9czXW9hiRPXU+JgRB89zQj/7ux5qsiF UcAPFv/XpxlHKWjvXmth0SIkvuZnLZZdARHUd3/YDcA+VD2OE0hQOBkLCpyvhVmBTP+h DzKmOZOqTuK5yv1J2UeBNwMGSx28bY0ePa3jNenjrmafDWhv19j/hnTMdLEdQ2XLFYmJ C1S4zYoxlQfGDgYNORYfAw4IvP6zVYgIz+ZlvfOtnC0FfeUQc/Wd0OTEK889r7bEK5rD ho2rKbZRpneL3iNVT16TzBbHPjmmRObQJwQMMb7PSYFQWkZN/IUBAo6bLGtg70TcLGDL 72Gg== X-Gm-Message-State: ALoCoQmwRtG2qNrEiWCHnzow08Sm9/cMu1VUcFuN4uLvx7Y5Z2ag0i7fnJFIsVKiBKSls/NRQxp+H4LcKem2cIwRIpuU85KHRRlt33aO5hK2W3IwAA58GAHzkFKvUsD9IdyGdBosUvB/VxhUgkTD0w84VgSx2Ym2IQ== MIME-Version: 1.0 X-Received: by 10.221.2.197 with SMTP id nv5mr13419947vcb.53.1423543854109; Mon, 09 Feb 2015 20:50:54 -0800 (PST) Received: by 10.52.74.73 with HTTP; Mon, 9 Feb 2015 20:50:54 -0800 (PST) Received: by 10.52.74.73 with HTTP; Mon, 9 Feb 2015 20:50:54 -0800 (PST) In-Reply-To: <54D94FB4.6090004@gmail.com> References: <54D94FB4.6090004@gmail.com> Date: Tue, 10 Feb 2015 08:50:54 +0400 Message-ID: To: Stanislav Malyshev Cc: PHP Internals , Yasuo Ohgaki Content-Type: multipart/alternative; boundary=089e0115fd02bf2e20050eb4a180 Subject: Re: [PHP-DEV] Re: Design by Contract From: dmitry@zend.com (Dmitry Stogov) --089e0115fd02bf2e20050eb4a180 Content-Type: text/plain; charset=UTF-8 On Feb 10, 2015 3:25 AM, "Stanislav Malyshev" wrote: > > Hi! > > > constraints. Type check is one of them. There are many people argue "This > > language is secure and robust because it has _static_ types". > > These people are wrong. Languages can't really be secure or robust, only > code implemented in these languages can, and we have witnessed many > examples of vulnerable code written in pretty much any widely used > language. Having strict typing may protect against some very basic > errors, but in well-designed and well-tested software such errors would > be rare, and in badly designed software type strictness would not save you. > > > Here comes DbC, once we have contracts for pre/post conditions. We are > > safe from calling functions with invalid parameters during development, yet > > we have optimum performance for production since there is zero contract > > checks > > with production mode including opcode. > > That assumes perfect test coverage in development, both code-wise and, > more importantly, data-wise. Which is impossible. While having assert > primitives that can be turned on and off looks like a useful concept to > me, I don't think it is some kind of magic solution that will change > everything. DbC is just an approach that may help to write safer programs. Of course, it's just a tool and can't gurantee anything. It's also possible to write safe code in assembler, but it's more difficult. Thanks. Dmitry. > -- > Stas Malyshev > smalyshev@gmail.com > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > --089e0115fd02bf2e20050eb4a180--