Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109779 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 30651 invoked from network); 22 Apr 2020 18:25:15 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 22 Apr 2020 18:25:15 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 06B94180510 for ; Wed, 22 Apr 2020 09:56:56 -0700 (PDT) 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.3 required=5.0 tests=BAYES_00,BODY_8BITS, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS62371 185.70.40.0/24 X-Spam-Virus: No X-Envelope-From: Received: from mail-40132.protonmail.ch (mail-40132.protonmail.ch [185.70.40.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 22 Apr 2020 09:56:54 -0700 (PDT) Date: Wed, 22 Apr 2020 16:56:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail; t=1587574612; bh=PxrNzQWj8kWe8jCie1H3XO81MyQFI1O+orDWCuF4PAQ=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=T+VA467Ae2kZ0ASrS7F0MBZGeNXiuhPunZMyWMI6/IcvdDfuKHttmLS23OIhEkZwX 2F2IS6FIdDF2PXxxVixN61wur1cFP1dmx5P6PFCT4bUOQ6S5KxCYx/C4JsRXsmyh+q yUVeLLYcXdcKRupi6vNwnmTT8At0XHgpZGeAR6UQ= To: Dan Ackroyd Cc: "internals@lists.php.net" Reply-To: moliata Message-ID: <6pYNtxu_0sImXziqQJB6p3nOYx-Dca_fdrTkfvjpHD9XxmWioPFZ01x44xk1n071D-MxZX16_8mEFrzqRVmTgecqDWsxnivqjsiei4KSTbw=@protonmail.com> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Typed callable properties From: moliata@protonmail.com (moliata) Hello, thank you for your opinion. In response to you mentioning that fixing this problem would be a huge amount of work, I would like to reiterate the idea = of simply ignoring context-dependent problems for the time being. In fact, we = can observe this behavior in parameter/return type hints already. As such, it doesn't make sense to make just property type hints a special case/exceptio= n. Moreover, I oversaw Sara Golemon's comment in the `mixed pseudo type` RFC t= hat she would like to use type aliasing and union types instead, at least in th= e long run. The problem that comes up with this approach is that even if we d= id something like this: `use mixed as string|int|...|callable;` ...we couldn't apply this `mixed` type alias to properties as callable type= is not allowed to be used with them. Best regards, Benas Seliuginas =E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90 Original Me= ssage =E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90 On Wednesday, April 22, 2020 5:29 PM, Dan Ackroyd = wrote: > On Tue, 21 Apr 2020 at 14:08, moliata moliata@protonmail.com wrote: > > > > > > I wanted to ignite a friendly discussion whether > > PHP should allow typed callable properties. > > IMO no. > > Trying to fix the problems with callables would be a huge amount of > work, and not actually give that much benefit. Even just documenting > the problems with callables* is a non-trivial amount of work, and I > suspect there are many horrors lurking with the SPL code related to > them. > > > I believe we should look into... > > I'm pretty sure that choosing a different problem to solve that: > > - would be easier to solve. > - provide more benefit in the long term. > - not require breaking a lot of userland + internal code immediately, > but instead allow for migration over a longer period. > > My thoughts on adding 'function types' are here: > https://github.com/Danack/FunctionTypes/blob/master/function_type_rfc= .md > > There's still more than a couple of known problems that need to be > worked through, as well as probably unknown problems lurking. As emai= l > is not a good format for carrying out discussions, if people want to > take part in that discussion, doing it in that repo would be better > imo. > > Assuming the problems remaining can be addressed, that would give us = a > more useful feature, and the existing 'callables' can be slowly > deprecated and maybe removed from PHP in the distant future. > > cheers > Dan > Ack > > *[problems with callables] - https://wiki.php.net/rfc/consistent_call= ables >