Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:103524 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 13162 invoked from network); 28 Nov 2018 00:52:37 -0000 Received: from unknown (HELO out4-smtp.messagingengine.com) (66.111.4.28) by pb1.pair.com with SMTP; 28 Nov 2018 00:52:37 -0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 7B060221EE for ; Tue, 27 Nov 2018 16:16:20 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Tue, 27 Nov 2018 16:16:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=M3+bGM b5LoauEHIorbNW2h4yPyzSAM8yIv89dVR7jlw=; b=iF5kqk/h6nyjAtcViFu4or jcFk35BaGmhJ1WvAqP2XiM7THU4xRUzGdCvGFd97Mw+FWCSbyipom4cLMEzT+shx zrU7uz9uphp+XtMcTz0LZWGnwa1ZUrWq4UbdG/KemO3xUU1SQw1/cAhwQNXPjSK8 p9AesrvNT3L9yz7jPHW7IrjBjMk8CUyydl93aIaaG7Xgn88Neq0aepYuUEVgqHjJ qRks/FlCrPPFEe1PSGlAMkopPID3b5m4Ugqlh2/TQGGDJys51EFOM+24Hh4jybBy aB1WfI+klc0NYk/CJL1S/2OGywtDBoi9J5pvlXrTo+RfAdjxn5lOQzwMFkxvy3Dw == X-ME-Sender: X-ME-Proxy: Received: from vulcan.localnet (216-80-30-152.s3222.c3-0.frg-cbr1.chi-frg.il.cable.rcncustomer.com [216.80.30.152]) by mail.messagingengine.com (Postfix) with ESMTPA id 9CE03E4A3B for ; Tue, 27 Nov 2018 16:16:19 -0500 (EST) To: internals@lists.php.net Date: Tue, 27 Nov 2018 15:16:05 -0600 Message-ID: <1729885.aYpoBY8SBC@vulcan> In-Reply-To: References: <2701692.XuXcyRlYA4@vulcan> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart2525358.qqSHtz50cN"; micalg="pgp-sha512"; protocol="application/pgp-signature" Subject: Re: [PHP-DEV] [RFC][Discuss] Covariant return- and contravariant parameter- types From: larry@garfieldtech.com (Larry Garfield) --nextPart2525358.qqSHtz50cN Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" On Tuesday, November 27, 2018 3:00:27 PM CST Levi Morrison wrote: > On Tue, Nov 27, 2018 at 11:36 AM Larry Garfield wrote: > > Looks like fun! > > > > Would this also include allowing a return type of `static`, which would be > > useful for the "Return the object that was invoked" case or "return a new > > instance of the same object" case? Currently we're limited to `return > > self`, which is, of course, not the same thing and less flexible. > > > > --Larry Garfield > > It does not. To be honest, I did not think of it until your question. On Tuesday, November 27, 2018 3:04:30 PM CST Marcos Passos wrote: > Supporting `static` return would come in handy to define interfaces for > immutable objects. Exactly the sort of use case I was thinking of. Or for builder objects, where you mutate the object in place and then return it. That's a common pattern, but return self and subclasses don't play that nicely there. Levi, is that something that could be reasonably added to this RFC or is that Hard(tm), like scalar/callable/etc? (I don't know that a static/self parameter declaration is even a thing, so it probably doesn't matter there; it does matter for returns, though.) --Larry Garfield --nextPart2525358.qqSHtz50cN Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEE/ph/GXfY8v0YwFBp4MMKwDFxYXcFAlv9tBUACgkQ4MMKwDFx YXdO+Af+JMCLr0Jzoo80NDt0EOi1kTLCwOkc2PuKUJsXeF0rN7q0ZGeVHxexPVjH TuAqBCr6qK217T8wyWd/ROHyHAhajjsuUQQQZzcpS4dB2Dh0iYzRfM7H7KLv0ax+ FDfT+KC0ygLHYFCtW4j9KZTdeJ2GEFgxW8GGS6FACG++sO+6s7X3ZcM1avzmwrLu T/CV84/HwTx/ovrfV5WSCVdr2hNS1uZ2BBZOz5yTm+j7SfsPZzS8Dq8UsSwXhJJq GO75wD+3Htn9CnNYNoks5ExZVBviMfT+xe9OtMByrLM61dYHA7bUIILNvOvpoOkr FAVZAmk/x5C1vPuvSDP16kj9i+aRkg== =m7BY -----END PGP SIGNATURE----- --nextPart2525358.qqSHtz50cN--