Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82322 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57163 invoked from network); 10 Feb 2015 00:24:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Feb 2015 00:24:27 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.173 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.192.173 mail-pd0-f173.google.com Received: from [209.85.192.173] ([209.85.192.173:44608] helo=mail-pd0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8E/01-47508-ABF49D45 for ; Mon, 09 Feb 2015 19:24:27 -0500 Received: by pdbft15 with SMTP id ft15so34885828pdb.11 for ; Mon, 09 Feb 2015 16:24:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=Sb6fY4SbAzmK8U3xgrlOv2ujOiSLayq81ET9Wy6XNxU=; b=0WvUB/IoNNGhqAl9iEsLdNRuNxD00jvQotL0F6ho0eLpvHQWBdzObJu0ov4E3mB1x4 964+H7dnGQL/zC1CWL/Nz9q9i+nL4EHdrjYSBckBaAGX/x9D2xaE4GPe4L6/MNung1rd UyL0v1cBfN6rQ5Zh7Es2Vfxly8SC5lUM3Ns8l5I2HJW5u7EB4BsEA8riMVpUfF2pkNP9 L1jYRFhVsohpcA1gl0aibWMO/nfGZ+iYgL16S5qOZzMx6sMB62tFJdnLnRN98Z6rAkk9 BojAzlh/zpxundNJ16SBTCXYRPlMk1bHFT0UWXqGNp7Uqx5ak7Yrg9SX/PUCKQUgWrEx 2SZQ== X-Received: by 10.67.15.194 with SMTP id fq2mr634559pad.12.1423527863603; Mon, 09 Feb 2015 16:24:23 -0800 (PST) Received: from stas-air.corp.wikimedia.org (tan1.corp.wikimedia.org. [198.73.209.1]) by mx.google.com with ESMTPSA id uc2sm17429825pbc.56.2015.02.09.16.24.22 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Feb 2015 16:24:23 -0800 (PST) Message-ID: <54D94FB4.6090004@gmail.com> Date: Mon, 09 Feb 2015 16:24:20 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Yasuo Ohgaki CC: "internals@lists.php.net" References: In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: Design by Contract From: smalyshev@gmail.com (Stanislav Malyshev) 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. -- Stas Malyshev smalyshev@gmail.com