Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108059 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 68680 invoked from network); 9 Jan 2020 16:17:24 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 9 Jan 2020 16:17:24 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 667A11804D1 for ; Thu, 9 Jan 2020 06:23:01 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HTML_MESSAGE,HTML_OBFUSCATE_05_10,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com [209.85.160.178]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 9 Jan 2020 06:23:00 -0800 (PST) Received: by mail-qt1-f178.google.com with SMTP id g1so5925646qtr.13 for ; Thu, 09 Jan 2020 06:23:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dqxtech-net.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=kxyYg+NrfoStXxmh+VZ1j8L19wFJ62CYor+yH/ZVwBs=; b=sNcdtJXcmjKyHlcJhg7IiBgFPwVC6AoerVNJjq4Il53+MFhk/c83gycqcKjzps3OQM Cjg6BUlWwQ7dVb1raORZB8+xuXjCXnVkTsstUe2INVotPAUoTMV8LQuYBnSGbe1QWMMR aDSJz/NkZr9P2uMYq3e6Uw0yhql2L4WZJQaCByhJEHGl6/YFdSFoURBiqKKvNR7F4FYe +itgPFRRgJG4yzCC/U82EUhh0+fjizBnrZJGOpFH0MER5h63RrUlgdH2vM4YL9kHV4pQ hUyKRFkkH8r9aB7PuGsBm/jXog+aE3G6sVXfW2g1+Mpxju4Co79Cw4MbChtkGgJx4xuj cAaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kxyYg+NrfoStXxmh+VZ1j8L19wFJ62CYor+yH/ZVwBs=; b=hIjYw34ZID0bN/7GY7wXoXc9y+eky1ptUsNzdifm/fLLCnbi3Etpj8uNWVf8hI2RRp BEgDn1lcIowhr2ffa+rlh7VR1oVbZH1EOKDPFPKGiSa//rhdPsPViNd5LFLlrht1nQeH f+WTXzTnr0l8anyRSvq4oTwa5Q46EpsdLQ8hUP5eVOlBXU9Qr3Y7FQYBxX/CtZBm24F9 wxivuxWQnqyL/d0WhdcCJLkvy1rJXPrtQ+0e6Y9ITDKIj5hhMBSZLz/YNLuQDxi0OjtO yQL/an+6Pi6dYO4MiTnqPuwb+CHiEGRP2Y0E9bHd5b55kuUoFa2gCbooGZ1KQ6egpdy7 8FTg== X-Gm-Message-State: APjAAAWo2Knp649koSQ0k38uRDprN8HqQX56C9RdRkSv3xTJvlTOrddd rscddMNQ/cOFTnqQSQaaL6JLjek8zdU= X-Google-Smtp-Source: APXvYqxCjHKFt5aOSG9/3J4X+4osKGuxEsHAG1sz83lfcmulqT3OJDKVqLsD69fMKoN0cixZR4UVxA== X-Received: by 2002:ac8:478a:: with SMTP id k10mr8033924qtq.260.1578579776756; Thu, 09 Jan 2020 06:22:56 -0800 (PST) Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com. [209.85.222.174]) by smtp.googlemail.com with ESMTPSA id g53sm3327026qtk.76.2020.01.09.06.22.55 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 Jan 2020 06:22:56 -0800 (PST) Received: by mail-qk1-f174.google.com with SMTP id r14so6023355qke.13 for ; Thu, 09 Jan 2020 06:22:55 -0800 (PST) X-Received: by 2002:a37:e50a:: with SMTP id e10mr9594037qkg.46.1578579775774; Thu, 09 Jan 2020 06:22:55 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 9 Jan 2020 15:22:44 +0100 X-Gmail-Original-Message-ID: Message-ID: To: Larry Garfield Cc: php internals Content-Type: multipart/alternative; boundary="000000000000c8e6d1059bb5bed3" Subject: Re: [PHP-DEV] [RFC] Static return type From: andreas@dqxtech.net (Andreas Hennings) --000000000000c8e6d1059bb5bed3 Content-Type: text/plain; charset="UTF-8" > However, $this is not a real type, and it is unclear what the advantage of specifying $this rather than static would be from a type system level perspective. Perhaps not from a "type system level", but from a more broad "enforced contract" level. E.g. IDEs or code inspection tools can warn if a method will not return $this. This also means recursive calls also need to return $this instead of static. class C { function foo(): static { return clone $this; } function bar(): $this { return $this->foo(); // IDE can complain. } } On Thu, 9 Jan 2020 at 15:07, Larry Garfield wrote: > On Wed, Jan 8, 2020, at 5:42 AM, Nikita Popov wrote: > > Hi internals, > > > > I would like to propose the following RFC, which allows using "static" > as a > > return type: > > > > https://wiki.php.net/rfc/static_return_type > > > > While I'm personally not a fan of late static binding, we do support it > and > > people do use it quite heavily, so I think we should also support it in > > return types. > > > > Regards, > > Nikita > > > Is "squee!" an appropriate response on the list? For interface authors > this is a huge deal. > > --Larry Garfield > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --000000000000c8e6d1059bb5bed3--