Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78116 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15626 invoked from network); 16 Oct 2014 14:46:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Oct 2014 14:46:22 -0000 Authentication-Results: pb1.pair.com header.from=inefedor@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=inefedor@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.174 as permitted sender) X-PHP-List-Original-Sender: inefedor@gmail.com X-Host-Fingerprint: 209.85.212.174 mail-wi0-f174.google.com Received: from [209.85.212.174] ([209.85.212.174:41842] helo=mail-wi0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8A/65-11594-D3ADF345 for ; Thu, 16 Oct 2014 10:46:21 -0400 Received: by mail-wi0-f174.google.com with SMTP id h11so1915420wiw.1 for ; Thu, 16 Oct 2014 07:46:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:to:cc:subject:references:date:mime-version :content-transfer-encoding:from:message-id:in-reply-to:user-agent; bh=0iSczVR1PtS/5IpdH//NpN53zauclJyU1i6LyJYUkKc=; b=lowpfxT+9x5ElmU35BB32PfZ5Z2OJ6tYkGr0tsZvbt5rDHGGvvcudCd1fWDOOeqNtl p50W6mUEqtxxRL5JXOg4ay7nfy+qmFgxLXdN32BKeeuv/NMDhPtjmoP9xY4HAGVYQ0sR WXlpqyVPExOIS+rkInqFVsSvXqqTzMTplewUWEyPoGNLRb3VpPPR4wXjgHbxeWxej3hX kOzlc2YtuOKiucNkV0EgHDfoFz7EYjeqBL9/gF4ovxHrviwf/dXCDcJtNN63Hp0aRxc1 izeVoSiVXQegoDC11pa1ngoEFrl/wPdxKTbxeHdQHknQxenYJoU4fuVcGXvWA1MiOkM2 73Gg== X-Received: by 10.194.216.232 with SMTP id ot8mr2762853wjc.74.1413470778181; Thu, 16 Oct 2014 07:46:18 -0700 (PDT) Received: from nikita-lenovo ([94.200.99.202]) by mx.google.com with ESMTPSA id mc4sm2258139wic.6.2014.10.16.07.46.16 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 16 Oct 2014 07:46:17 -0700 (PDT) Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: "Davey Shafik" Cc: internals References: Date: Thu, 16 Oct 2014 18:46:34 +0400 MIME-Version: 1.0 Content-Transfer-Encoding: Quoted-Printable Message-ID: In-Reply-To: User-Agent: Opera Mail/12.16 (Linux) Subject: Re: [PHP-DEV] RFC: Return Types Update From: inefedor@gmail.com ("Nikita Nefedov") On Thu, 16 Oct 2014 18:39:06 +0400, Davey Shafik wrote: > I very much like this =E2=80=94 though I would say it was dependent on= the = > nullable > types RFC (like splat and variadics were codependent). > > While I would like to see the introduction of a void type, I understan= d = > and > respect the limitations on the RFC. > > However, one thing that I do think is missing, is the equivalent of Ha= cks > `$this` return type. You have `self` and `parent`, but I think without= a > `static` equivalent you can break things: > > class foo { > static public function instanceOf(): self { > return new static(); > } > } > > class bar extends foo { } > > foo::instanceOf(); // new foo, this is fine, returns `self`. > bar::instanceOf(); // new bar, no longer `self` Hi, bar is considered as instance of foo so shouldn't be any problem. = Otherwise it would break LSP