Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98511 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64310 invoked from network); 12 Mar 2017 20:41:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Mar 2017 20:41:16 -0000 Authentication-Results: pb1.pair.com header.from=yohgaki@ohgaki.net; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=yohgaki@ohgaki.net; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ohgaki.net designates 180.42.98.130 as permitted sender) X-PHP-List-Original-Sender: yohgaki@ohgaki.net X-Host-Fingerprint: 180.42.98.130 ns1.es-i.jp Received: from [180.42.98.130] ([180.42.98.130:39912] helo=es-i.jp) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AC/DD-38004-962B5C85 for ; Sun, 12 Mar 2017 15:41:15 -0500 Received: (qmail 120629 invoked by uid 89); 12 Mar 2017 20:41:10 -0000 Received: from unknown (HELO mail-qt0-f171.google.com) (yohgaki@ohgaki.net@209.85.216.171) by 0 with ESMTPA; 12 Mar 2017 20:41:10 -0000 Received: by mail-qt0-f171.google.com with SMTP id x35so20054272qtc.2 for ; Sun, 12 Mar 2017 13:41:09 -0700 (PDT) X-Gm-Message-State: AMke39nPCP+n0qYR5hy/N48lfHxbZz4wHSUwyC8kk+3hzvRTICoMsUKzIjPyv1KdMLa5ai06KEMn+4hqiVRyrA== X-Received: by 10.237.57.164 with SMTP id m33mr31252672qte.293.1489351263716; Sun, 12 Mar 2017 13:41:03 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.19.232 with HTTP; Sun, 12 Mar 2017 13:40:23 -0700 (PDT) In-Reply-To: References: Date: Mon, 13 Mar 2017 05:40:23 +0900 X-Gmail-Original-Message-ID: Message-ID: To: Michael Vostrikov Cc: PHP Internals Content-Type: multipart/alternative; boundary=001a11410306051986054a8e9d5f Subject: Re: [PHP-DEV] Type variants From: yohgaki@ohgaki.net (Yasuo Ohgaki) --001a11410306051986054a8e9d5f Content-Type: text/plain; charset=UTF-8 Hi Michael, On Sun, Mar 12, 2017 at 7:33 PM, Yasuo Ohgaki wrote: > IMO, C# like getter/setter is better though. > > http://stackoverflow.com/questions/11159438/looking- > for-a-short-simple-example-of-getters-setters-in-c-sharp > I pasted wrong URL. This URL has better example code. https://msdn.microsoft.com/en-us/library/w86s7x04.aspx While DbC is nice, but checks are only performed on dev environment for maximum performance and acceptable safety. Therefore, developers must implement mandatory validations at trust boundaries to ensure software safety. i.e. Code correctness and security. Your proposal is useful for this. Please note that, with DbC, caller has responsibility to make correct calls that follow contracts. e.g. Caller must use sane parameters for callee. With this design, basic objects/functions, that may execute validation code repetitively, can safely omit validations for maximum performance as long as contracts are maintained. I'm not against to have method/feature that validates object, but it would be better to implement DbC support, then runtime object validation support. Otherwise, users would design poor performance objects that execute validation code repetitively. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --001a11410306051986054a8e9d5f--