Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81901 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46877 invoked from network); 5 Feb 2015 11:46:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Feb 2015 11:46:20 -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.175 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.175 mail-vc0-f175.google.com Received: from [209.85.220.175] ([209.85.220.175:53186] helo=mail-vc0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 40/B3-27691-B0853D45 for ; Thu, 05 Feb 2015 06:46:20 -0500 Received: by mail-vc0-f175.google.com with SMTP id la4so2520998vcb.6 for ; Thu, 05 Feb 2015 03:46:17 -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=cq/qczISgppYJiB08HNXERxEMGgUnB7w1RB2zdiNj2o=; b=HVqHqOJpll4slIKMFL484Fs5NjFdmzyAIewK+RySx5M09Y41sqPhzopEWHPfeBrTEH jSY2TTd9VPNgKKIt8OfR8v0CNll4UOTnzB/0Mhha4uojDjwVQhzAHDEq9ioQYo7xRh/U hsI7IWo6aQ2qXZwRCC43fIA1SdFF+TiEnuzpYUF6+uJ2XQimhcXrHIO9dedweYjH6QR3 uH+nr733PDmXxjUcce7iFWCTs6F6nZOz/F/dnmdOKalERNSlaHw1pqb1YzNNprF2053v ZNhXI0BY97vR8J7hOQTT5OL+ieKUAACjDnDFzBAx19vbjhsmYlJFDKTjm07I0/56qJ+7 Q6+A== X-Gm-Message-State: ALoCoQlfAm321aqEZ9GVklY2vHhYQ8qmduSwCT3tR0XTSEjV+IHUZVn/cH+P8CEal/P6Ir17FuQsPv+DGlVD1kobpPkAOXFXneikkVaPsvgkRBVaNi4FS5dcUATHVvPgkN4ss/dI/BSKUeJgclc+2KkDiCMS9b+/2Q== MIME-Version: 1.0 X-Received: by 10.52.26.18 with SMTP id h18mr1492989vdg.51.1423136777029; Thu, 05 Feb 2015 03:46:17 -0800 (PST) Received: by 10.52.74.73 with HTTP; Thu, 5 Feb 2015 03:46:16 -0800 (PST) In-Reply-To: References: Date: Thu, 5 Feb 2015 15:46:16 +0400 Message-ID: To: Patrick Schaaf Cc: internals , Yasuo Ohgaki Content-Type: multipart/alternative; boundary=20cf307d00760fe01d050e55dac6 Subject: Re: [PHP-DEV] Design by Contract From: dmitry@zend.com (Dmitry Stogov) --20cf307d00760fe01d050e55dac6 Content-Type: text/plain; charset=UTF-8 On Thu, Feb 5, 2015 at 2:38 PM, Patrick Schaaf wrote: > Am 05.02.2015 12:14 schrieb "Dmitry Stogov" : > > > > For php it may look like the following: > > > > function foo() > > require() > > ensure() > > { > > ... > > } > > > > It would require only one new reserved word "ensure". > > How would one access the function return value in the > output-assert-expression? > good point. we may use a reserved name. e.g. $result.or $return_value > And what about side effects in these expressions? Could they be suppressed > / made into errors somehow? > I afraid, we won't be able catch possible side effects of assert expressions. For now, we may just relay on user, in the same way as with assert() now. Thanks. Dmitry. > best regards > Patrick > --20cf307d00760fe01d050e55dac6--