Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91414 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99405 invoked from network); 25 Feb 2016 18:18:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Feb 2016 18:18:01 -0000 Authentication-Results: pb1.pair.com header.from=adam@adamharvey.name; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=adam@adamharvey.name; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain adamharvey.name designates 209.85.217.176 as permitted sender) X-PHP-List-Original-Sender: adam@adamharvey.name X-Host-Fingerprint: 209.85.217.176 mail-lb0-f176.google.com Received: from [209.85.217.176] ([209.85.217.176:35684] helo=mail-lb0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0B/83-11730-9554FC65 for ; Thu, 25 Feb 2016 13:18:01 -0500 Received: by mail-lb0-f176.google.com with SMTP id bc4so33735361lbc.2 for ; Thu, 25 Feb 2016 10:18:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adamharvey.name; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=xuWwNZzXJPjVd8gFyN7TWNNFc54/sKWdH4QcTB2EQ5E=; b=VOefHnJFTpNaLtPd53ZLe5Fer+zq1z/Qgg3MommkMg7TB4RF4f7g2sOeAMyNyoD0FB tKyUiPFcwnUiTwuQr6194qDpRZag8GE89fAFRbY9B1h6sTyCX/VDQTnw/mmNFY0AfJ2K PJ66sSBQwrvKcwM++1nkw4wp3e9ViS8qOyNPI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-type; bh=xuWwNZzXJPjVd8gFyN7TWNNFc54/sKWdH4QcTB2EQ5E=; b=RvXbPg/+0SbivIo4jA5FLQN9vcF24kqGKJbRVhQjfkSyKcd0t/xtfP0WixlP42hP9O BHzlD/KeFyCdCEzevysxoiJ2BQkGLMD/MMkUYOMMzcRAO7r9Otiwbe7QZeX+6Hp7gVbS wBLCLVwd9ovbtfRBg+iBVNuSwhnrLHMIzGBsw7tzv9t7eXBsN0pm++ai8c/e5wYxhXDv O8FanRRrT09HBPGM/r1JHvwFpyS1QAPOcAiqGd7rD7KqF84bl3d2ZClRDm/yQah7QSKL E/d6NGwmqfSSZxrBGRkf9BhcE0T+fHexAa7wiy1++fQ1IN8r8sP91+YRTHmDOMFmqYEr 9MIQ== X-Gm-Message-State: AG10YOQeHmgQK+9ArlmiTrTz5Fhky5k4L6W1i9BqImiNFfAsInLyvmMzSdyjobpUZAHeICAbiKaTUGWJpP6nhA== X-Received: by 10.112.137.41 with SMTP id qf9mr17228905lbb.140.1456424278296; Thu, 25 Feb 2016 10:17:58 -0800 (PST) MIME-Version: 1.0 Sender: adam@adamharvey.name Received: by 10.25.216.74 with HTTP; Thu, 25 Feb 2016 10:17:38 -0800 (PST) In-Reply-To: <97.82.11730.D8C3FC65@pb1.pair.com> References: <97.82.11730.D8C3FC65@pb1.pair.com> Date: Thu, 25 Feb 2016 10:17:38 -0800 X-Google-Sender-Auth: d7FoyzM_45HFv3HYTXJg68cIsoc Message-ID: To: Andrea Faulds Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Re: [RFC] Callable constructors From: aharvey@php.net (Adam Harvey) On 25 February 2016 at 09:40, Andrea Faulds wrote: > Instead of changing __construct to implicitly create the object it acts on > in certain contexts, I would suggest a simpler approach: add a magic ::new() > static method that exists on all classes (think ::class, although that is a > constant). Foo::new() would work identically to new Foo(), and would solve > your use case. It would be more intuitive, I think, and it avoids the > problems of changing __construct. (Un?)fortunately, new() is a valid method name for userland classes in PHP 7.0. Adam