Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108084 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 71541 invoked from network); 10 Jan 2020 00:59:27 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 10 Jan 2020 00:59:27 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0BE771804F2 for ; Thu, 9 Jan 2020 15:05:14 -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.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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-yw1-f53.google.com (mail-yw1-f53.google.com [209.85.161.53]) (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 15:05:13 -0800 (PST) Received: by mail-yw1-f53.google.com with SMTP id h126so3406486ywc.6 for ; Thu, 09 Jan 2020 15:05:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=newclarity-net.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=v9ZaNt8UkNuMbaieEFPn6tIh5CqLBCrL4ay8EDeXmcc=; b=EOl1cdiVthQ+297fdV5094l1xnB9dBzGg+xB9Z5jrpBbO9FARVJyQsPUU9CvpFzCSk qQCKp4QnjAT522CXvpY3Hq6tEiaDTUvT4OTbx47L/ofx6ChxU6MV8JQ9pMHEpsw+gm0H NcVBkdoK+Lcsr4639CaY0SYmoSkNcACVmQVr6a8N17wzH/fzAKtk/71KiD4bU0UM/yQQ S6ncMgVLPJIsbm0GpOi0I1XPzzIgkdlA0pQ25X3MvMI+9twCu8wNBOthUdSs7hVfQZe3 2bsR7BzGrmdSIpUvDqs2SEgPGfywGknQGhvZ/YzsUOpsYnbfTbv2ZUiGIKfWvvx69mAX Nwwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=v9ZaNt8UkNuMbaieEFPn6tIh5CqLBCrL4ay8EDeXmcc=; b=b88FwJGlpZ3QblGXrEfUO0PMlKOk4Yi7ZVOwTFNHP2qKkdh2H/fykCmsOhySzLl0pg 0FSoa9Z7LzwBOg9aUL79MtooziZ7jqn6BKZWyChF6AO+mwbGKAYr1RZA6gcNLx5vH8hR nV+cQ2MsDcYJ0bXYKX4HkztftPE+oIuggX7J57w/4MMdxgmMvrwMClPjDnuTEqSMsMdM ghc2FAsNRgX0IRiYgRv0K2VmX5BZ4JsCEwUEukGouRPgbtJIv/LUM4Qy1JKa4yjanDX3 7/SL8tOnFZktzqL3+FhNTl0AYIBzOkGIJnA+iPljxm3/xN36nx75CA8OPfavk61LiORx 8nqw== X-Gm-Message-State: APjAAAVh4EBRsDUYrwUumfJbcEa3SUCbIS7qNFqV9YsSQcV++cqA6QO5 mcG40Gx9DuEtrYtYv+Z2vOE1RA== X-Google-Smtp-Source: APXvYqyBi9Vzt2+GR60vbkF8bbZK00H1Gt7n6jh+KjuJmEk+gWPa/30ZvKGfze67kLcZEiYctbeQQA== X-Received: by 2002:a81:4911:: with SMTP id w17mr319392ywa.467.1578611112843; Thu, 09 Jan 2020 15:05:12 -0800 (PST) Received: from ?IPv6:2601:c0:c680:5cc0:480:e2c0:f7b2:a682? ([2601:c0:c680:5cc0:480:e2c0:f7b2:a682]) by smtp.gmail.com with ESMTPSA id k133sm145720ywc.9.2020.01.09.15.05.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Jan 2020 15:05:11 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) In-Reply-To: Date: Thu, 9 Jan 2020 18:05:10 -0500 Cc: Internals Content-Transfer-Encoding: quoted-printable Message-ID: 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> To: Marcio Almada X-Mailer: Apple Mail (2.3445.104.11) Subject: Re: [PHP-DEV] [RFC] Allow ::class on objects From: mike@newclarity.net (Mike Schinkel) Hey Marco, > On Jan 9, 2020, at 5:04 PM, Marcio Almada = wrote: >=20 > Regarding the inclusion of new keywords with similar behavior of = `:class`: >=20 > Would `Interfaces\FooInterface::trait` or `Traits\FooTrait::interface` > cause a run time error? If I'm not mistaken `::class` can't trigger > error because it can't trigger autoload like `class_exists()` calls > does. >=20 > Currently `::class` can be used to resolve any name like > `trim::class`. IMMO it would be weird to have `::class` with the > current no autoload / error free behavior and then `::trait`, > `::function` and `::interface` triggering autoload and emitting some > error level. You are absolutely correct. I am so used to PhpStorm highlighting = issues that I sometimes assume that PHP will throw an error/warning for = the same. So if ::interface and ::trait were added, then (tools like) PhpStorm = could have enough information to flag them if developers misspell them = or they are otherwise unknown. > And also it would be weird to have `::trait`, `::function` and > `::interface` with the same loose behavior as `::class` Why weird? =20 I can only assume Foo::trait vs. Bar::interface vs. Baz::class would not = be hard to grok, and that it would would provide more valuable = information to a reader than Foo::class vs. Bar:: class vs. Baz::class. > in that case, it seems less surprising to have just `::class` > everywhere instead. How so? I was very surprised when I first realized that I could do = MyInterface::class, but I would not have been surprised by = MyInterface::interface. > `::function` That said you bring up one I did not but would also like ::function as = well as `::method` and even ::var or ::variable and ::const or = ::constant. -Mike