Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82018 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 80924 invoked from network); 6 Feb 2015 07:29:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Feb 2015 07:29:32 -0000 Authentication-Results: pb1.pair.com header.from=francois@tekwire.net; sender-id=softfail Authentication-Results: pb1.pair.com smtp.mail=francois@tekwire.net; spf=softfail; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain tekwire.net does not designate 212.27.42.2 as permitted sender) X-PHP-List-Original-Sender: francois@tekwire.net X-Host-Fingerprint: 212.27.42.2 smtp2-g21.free.fr Received: from [212.27.42.2] ([212.27.42.2:37276] helo=smtp2-g21.free.fr) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 96/E6-45146-B5D64D45 for ; Fri, 06 Feb 2015 02:29:32 -0500 Received: from moorea (unknown [82.240.16.115]) by smtp2-g21.free.fr (Postfix) with ESMTP id 5BC8E4B0283; Fri, 6 Feb 2015 08:26:07 +0100 (CET) Reply-To: To: "'Yasuo Ohgaki'" Cc: "'Pierre Joye'" , "'PHP internals'" , "'Dmitry Stogov'" References: <01d601d04146$6fbda4c0$4f38ee40$@tekwire.net> <020c01d0414b$2c3a1120$84ae3360$@tekwire.net> <023201d0415e$5731d800$05958800$@tekwire.net> In-Reply-To: Date: Fri, 6 Feb 2015 08:29:22 +0100 Message-ID: <02b701d041de$a134c680$e39e5380$@tekwire.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQGgxP9HPTh52uHWkGo6jLSeXRdtNAIuYisqAXiAI4oCe0Gg3wHoiozGAesUmP8DLuqyBQF42jCWAgkXey2cvPdakA== Content-Language: fr X-Antivirus: avast! (VPS 150205-1, 05/02/2015), Outbound message X-Antivirus-Status: Clean Subject: RE: [PHP-DEV] Design by Contract From: francois@tekwire.net (=?utf-8?Q?Fran=C3=A7ois_Laupretre?=) > De : yohgaki@gmail.com [mailto:yohgaki@gmail.com] De la part de Yasuo = Ohgaki > > Thank you for your time. It's based on annotation approach. This kind = of=20 > implementation requires a lot of work... I have an idea of a way to do it with limited work. Most important, = everything would be in an extension and would require no change in the = PHP engine. > I have more simpler approach in my mind based on current PHP language > not to invent new language. I'll use syntax something similar to = Dmitry proposed. > >Let me explain my original thought. > > Since we have reserved __functionname(), __some_functioname() should = not have > BC issues. I understand your proposal but I repeat the same from the beginning : = once modified, your code cannot run in PHP 5 anymore (especially if you = use 'require'). The (huge) BC break is there, not in the fact that we = use a hidden reserved function name. Additionnally : - that's a detail but I find that 'require' and 'ensure' are less = intuitive that 'in' and 'out'. - invariants are for classes, not functions. Which syntax would you use = ? - I insist on the importance of checking 'smart' built-in phpdoc types = because, unfortunately, in PHP, most is_xxx() functions don't do what = the user would intuitively expect. Starting with is_int('123') returning = false, while '123' is a correct int argument value. The RFC will include = a table of 'restricted' type juggling explaining the rules to match = phpdoc types with zval type/value. Cheers Fran=C3=A7ois