Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97750 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 36020 invoked from network); 14 Jan 2017 10:27:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Jan 2017 10:27:08 -0000 Authentication-Results: pb1.pair.com header.from=php@fleshgrinder.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=php@fleshgrinder.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fleshgrinder.com from 212.232.28.122 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 212.232.28.122 mx201.easyname.com Received: from [212.232.28.122] ([212.232.28.122:52369] helo=mx201.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 42/46-00729-AFCF9785 for ; Sat, 14 Jan 2017 05:27:07 -0500 Received: from cable-81-173-135-7.netcologne.de ([81.173.135.7] helo=[192.168.178.20]) by mx.easyname.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1cSLY9-00042P-3o; Sat, 14 Jan 2017 10:27:05 +0000 Reply-To: internals@lists.php.net References: <0DE25BF8-D349-48EF-A83B-8837DD4AD1E0@gmail.com> <5efcc230-c67b-4439-cc82-b31eacbf36db@php.net> <7c8c8801-a849-6fd2-91e9-954030c55e83@fleshgrinder.com> To: Andreas Heigl , internals@lists.php.net, Wes , sebastian@php.net Message-ID: <2051639b-1b63-2e44-51b0-381caa54dfd0@fleshgrinder.com> Date: Sat, 14 Jan 2017 11:26:57 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-DNSBL-PBLSPAMHAUS: YES Subject: Re: [PHP-DEV] Explicit constructor call and polymorphic dispatch From: php@fleshgrinder.com (Fleshgrinder) On 1/14/2017 11:20 AM, Andreas Heigl wrote: > Do we as "makers of PHP" want to dictate the user what the "intended" > behaviour of PHP is? Or are we treating the user as a responsible person > that knows what to do and also not to do? > > Personally I'm in favour of the later. Let the user be able to call > __construct whenever they like. It's a special method which is clearly > visible by the two underscores at the start. So the users either know > exactly what they are doing or they need to learn it. > > Translated to a different example this discussion is like: "Let's remove > the handle from the window because someone might be able to open the > window and jump out of it". The handle is there for a valid reason. And > as a window-maker I have no idea in what way it might be used. But I > have to accept that there are people missusing it. But should I limit > all those users with a valid use-case for it just to save some from > missusing it? And if we start with that, where should we stop? > > Just my 0.02€ > > Cheers > > Andreas > Yes, that is exactly the question. This needs to be voted on. Rust would be an example that protects you and C/C++ would be examples that do not. Both approaches are valid approaches. Note that the dictation will not always work, this is why e.g. Rust has unsafe blocks. The corresponding thing in PHP imho would be reflection. Hence, if someone has a special case: - Rust: use unsafe - PHP: use reflection -- Richard "Fleshgrinder" Fussenegger