Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84212 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 42953 invoked from network); 3 Mar 2015 03:24:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Mar 2015 03:24:27 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.42 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.220.42 mail-pa0-f42.google.com Received: from [209.85.220.42] ([209.85.220.42:42871] helo=mail-pa0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7B/F6-14834-A6925F45 for ; Mon, 02 Mar 2015 22:24:27 -0500 Received: by padfa1 with SMTP id fa1so19920104pad.9 for ; Mon, 02 Mar 2015 19:24:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=YyjD+7820CsHm3EEKlaKWoNcYUEsuisJMHbLcjRwioU=; b=UhhZ5LnxbapHPh8Hqs5zGlM2vSMGP0RdqYBJkk2ehZcCEBe/rQ8wXLhHXGMFBQnsQO TPj38Ogx4B9A3MUV5FLAKmmdoOdO1+kM2ULfIMnCfR5pRSSQDhN/EbCKsfcbilEvVGz0 7i1bs6qIznpu6a6Pg45ZjSqEUVF8IKxsVxArud5gOujerp0yoGkhS3dyaMTZjYdi2nEL YIttQcgqSJ9mY+UC0SUKyHr9b+E9n9M/x281R+ZWBknufZn1pYfreenwZJ7WlDr+KOIo 2j+1+ygMk/lxoF7osEe1kqjfOlIYf821g0wvAG8nXrsjBhFMYEmC0ljv1GI7gPVkXERC HSxg== X-Received: by 10.70.98.239 with SMTP id el15mr51706785pdb.133.1425353063356; Mon, 02 Mar 2015 19:24:23 -0800 (PST) Received: from Stas-Air.local (108-66-6-48.lightspeed.sntcca.sbcglobal.net. [108.66.6.48]) by mx.google.com with ESMTPSA id hz8sm13508697pac.5.2015.03.02.19.24.22 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Mar 2015 19:24:22 -0800 (PST) Message-ID: <54F49882.9090901@gmail.com> Date: Mon, 02 Mar 2015 09:06:10 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Michael Wallner , Dan Ackroyd , "internals@lists.php.net" References: <54F38D29.9080007@gmail.com> <54F417E1.8010703@php.net> In-Reply-To: <54F417E1.8010703@php.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC][DISCUSSION] Constructor behaviour of internal classes From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > I'm not sure I can understand your crusade against this topic. I would start with trying to address my actual arguments, as opposed to dismissing it as a "crusade". I've described my arguments for it in my previous emails, is there something unclear there? I'd be happy to explain any point further. > Consistency with userland is beneficial, because the majority of PHP > developers probably do not expect `new` to yield anything than a > concrete instance or an exception. Of course, consistency with userland is beneficial. However, in userland we do not have many things that we have in internals - like operator overloading, function aliasing, etc. - because some of the functionality we consider risky and as such better to be left to internals/extensions. This is one more example. > Quoting php.net/manual: > > To create an instance of a class, the new keyword must be used. An > object will *always* be created *unless* the object has a constructor > defined that *throws an exception on error*. Manual can be fixed. > Do you know of any other case where a `new` operator in an object > oriented context can return NULL, except C++ where you have to > explicitly ask for that behavior? I can't say I am familiar with every OO language's implementation details, so I don't know. But I don't see why, if we think it's useful, we can not do it - especially given our factory methods/functions already do it. I think it's useful. -- Stas Malyshev smalyshev@gmail.com