Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108091 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 14477 invoked from network); 10 Jan 2020 19:23:38 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 10 Jan 2020 19:23:38 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8ECE81805C4 for ; Fri, 10 Jan 2020 09:29:32 -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=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS11403 66.111.4.0/24 X-Spam-Virus: No X-Envelope-From: Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (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 ; Fri, 10 Jan 2020 09:29:31 -0800 (PST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 3831221F6D for ; Fri, 10 Jan 2020 12:29:30 -0500 (EST) Received: from imap26 ([10.202.2.76]) by compute7.internal (MEProxy); Fri, 10 Jan 2020 12:29:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding: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=A2jC+7TBn7WtzoiDS6fl9z3zl3xI60gobPCUikR+m jw=; b=uP4yCpsLrdNsoWwQ9Nja+7WH15VeEPsaVWq6t2LyxjR8plamg64A6U/a+ FkCmYzKwa4gd6Lg9ePd76P6RSoc1sDuonctc8QrFtqwouiEUVWi0oj1aDqPlQ9dr N9L1/dFf3HQyxc/yNUOfcNrIdd4zKwYov1Wg32iV/z4DC9uq8o/CF6ofcKcvAPz8 fslc5ty7XNdb6pZh6h3OyWFGfIbPX5JIqA67QQvXis1mQcS5Gn7vMIHCAyzALEEw 5JHR3qCtIlAmZkjd/YrBfWZer7xiSN9C8VmeIfq8QWEFXlTPXagbybzkLfQ0Kq8X i9mCOqyZANUO5R9Qmxs4QHNIDwBtw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrvdeifedgleejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgfgsehtqhertderreejnecuhfhrohhmpedfnfgr rhhrhicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtg homheqnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlrghrrhihsehgrghrfhhivghlught vggthhdrtghomhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 7F8FE14200A2; Fri, 10 Jan 2020 12:29:29 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.1.7-740-g7d9d84e-fmstable-20200109v1 Mime-Version: 1.0 Message-ID: In-Reply-To: References: <13CC52AA-7690-42C6-89B7-B8FA4166BF38@newclarity.net> <57c08851-e6e2-c0bd-76e1-f7a0388d64b4@ralphschindler.com> <60610660-2E38-47BD-A998-1E226CEB3701@newclarity.net> <032B5597-6CB6-4F5E-BDDC-8A508C3FCE93@newclarity.net> <69403AE8-F8F6-4221-B31F-41B1E982A2C5@newclarity.net> Date: Fri, 10 Jan 2020 11:29:09 -0600 To: "php internals" Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Allow ::class on objects From: larry@garfieldtech.com ("Larry Garfield") On Thu, Jan 9, 2020, at 6:10 PM, Marcio Almada wrote: > Em qui., 9 de jan. de 2020 =C3=A0s 20:57, Mike Schinkel > escreveu: > > > > > On Jan 9, 2020, at 6:53 PM, Marcio Almada = wrote: > > > > > > Because we would be expanding a construct that already looks > > > inappropriate from a purely > > > semantic POV with aliases that also would allow inappropriate usag= e > > > `some_function::interface`. > > > I'd rather have a generally unsatisfying construct than a set of > > > "denormalized" constructs with > > > equal potential for human inaccuracy. > > > > > > Perhaps the problem is that `::class` was not exactly a good langu= age > > > design decision in the first place or maybe > > > it made more sense in the past and as the language evolved it star= ted > > > to appear to be named poorly. > > > > > > A more _general_ construct like a `nameof` operator, as we have in= C#, > > > could have been a brighter idea. See: > > > > Okay, I get your perspective on this now. > > > > So let us add ::nameof and deprecate ::class, then? And apply it f= or all symbols? :-) > > > > -Mike >=20 > It seems late to mess with `::class`, maybe not for having `nameof`. I've never been bothered by Interface::class or Trait::class, frankly. = But having to remember slightly different APIs for slightly different ca= ses that I often have to handle together has caused me no end of pain. = -1 to needing to think about which type of bracketed reference thingie I= am getting a name for. But having some kind of working way to reference a function that doesn't= involve concatenating a string onto a namespace constant would be *supe= r* nice. Whether it's called ::func or ::nameof I don't much care. Viz, replace this: $func =3D __NAMESPACE__ . '\myfunc`'; With this: use My\Code\myfunc; $func =3D myfunc::nameof; (Or basically anything that lets me not use strings to reference a funct= ion by name.) To the OP suggestion of $object::class, I don't think I've run into a ne= ed for it but since the name is already reserved I don't see a negative;= I'm good with it. --Larry Garfield