Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82432 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 41884 invoked from network); 11 Feb 2015 07:22:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Feb 2015 07:22:31 -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.181 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.181 mail-vc0-f181.google.com Received: from [209.85.220.181] ([209.85.220.181:42523] helo=mail-vc0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 83/48-33902-6330BD45 for ; Wed, 11 Feb 2015 02:22:30 -0500 Received: by mail-vc0-f181.google.com with SMTP id im6so586447vcb.12 for ; Tue, 10 Feb 2015 23:22:28 -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=HIBt1eYW58B287OW73uiPY7cx4Tb5u0NRJ+2a4I41Ps=; b=nHY2gCo9OxQ5GrY6eg3qqQmQgu5//gNEGcRjt55TZMwhAfNKPgsuHAXxQg7CrnOcew QQnQpMreOw3If8j0CnS+1+DAuohdnloRmDWc06RqyTo9cw2588yT5dmwNX1F0K47hPBh oWySLTsTlZ7Ce1jEPmjrIGQJ42QSa8Yei0NokuRhcQ9iJQBZAtH2TO58dtghCuEuULor f15eowQvgeetV1ldCgagkLXTQlOVNII86Ay3sK/9JYpE/vlM6UPdM3VMl6OV8jW984IS 98lzZKD9eR9NKw2KYq9Mgf1ZM5lJjx7h7hERW2OAsSRYeecPNBE7kTyXfSEVixy5hmyF s6EQ== X-Gm-Message-State: ALoCoQkzQThrffVi8dUFPsE86JzTbf9xut+epvBE5RRTxMLwrcwOPKSZyoOIh74DjaRFBAHq6v+FqpNxSg1F2GWEkyiVtX8CNMj+n+h7OAolErr0Tekj7lsv7mTcqiGqqngPRAeW403E5kBSdVfv+qRcIeWTE1Hv5g== MIME-Version: 1.0 X-Received: by 10.52.52.136 with SMTP id t8mr2075681vdo.49.1423639347893; Tue, 10 Feb 2015 23:22:27 -0800 (PST) Received: by 10.52.74.73 with HTTP; Tue, 10 Feb 2015 23:22:27 -0800 (PST) In-Reply-To: <54DAFD32.3000005@gmail.com> References: <54D7ED22.3080001@gmail.com> <54DAFD32.3000005@gmail.com> Date: Wed, 11 Feb 2015 11:22:27 +0400 Message-ID: To: Stanislav Malyshev Cc: Joe Watkins , Yasuo Ohgaki , =?UTF-8?Q?Fran=C3=A7ois_Laupretre?= , PHP Internals Content-Type: multipart/alternative; boundary=089e0115f0489eb07e050ecaddf6 Subject: Re: [PHP-DEV] Design by Contract From: dmitry@zend.com (Dmitry Stogov) --089e0115f0489eb07e050ecaddf6 Content-Type: text/plain; charset=UTF-8 Hi Stas, I agree, it may look weird at first, but if you familiar with concept it looks more or less natural. It's implemented in D, Effiel, it was a proposal for Java, etc Anyway, we will have at least 3 competing proposals. 1) contracts in doc-commetns https://wiki.php.net/rfc/dbc /** * @requires ($a >= 0) */ function foo($a) { } 2) contracts as part of the language https://wiki.php.net/rfc/dbc2 function foo($a) require($a >= 0) { } 3) contracts in annotations <= 0)>> function foo($a) { } The fact that we are working on (2) now, doesn't mean we will select it as a final solution. (3) is an interesting option as well. Thanks. Dmitry. On Wed, Feb 11, 2015 at 9:56 AM, Stanislav Malyshev wrote: > Hi! > > > Please steer clear of using the assert API, and in so doing avoid BC > > concerns with the current assert API. > > The operator can be called something other than "assert", I'm sure the > thesaurus has a lot of possibilities. > > > Please avoid adding a magic method and use the suggested syntax for > > invariant. > > > > class Some { > > require(invariant-expr); > > I think reusing syntax for existing operator in completely unrelated > context is a big mistake. Having code outside of functions is probably > not the best idea too. > > -- > Stas Malyshev > smalyshev@gmail.com > --089e0115f0489eb07e050ecaddf6--