Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108081 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 61608 invoked from network); 9 Jan 2020 23:58:46 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 9 Jan 2020 23:58:46 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C2E4B18050B for ; Thu, 9 Jan 2020 14:04:31 -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,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS 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-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) (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 14:04:28 -0800 (PST) Received: by mail-ed1-f51.google.com with SMTP id j17so7011818edp.3 for ; Thu, 09 Jan 2020 14:04:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=cE+1z0Fmkvo9VM+HNd4YEpp1HjHZW628cBVTSxN7K6c=; b=qKcSVtGDl/MwmQCv6YMfpJ582bg7g5CzVu5+LWLgr9LNvxnpJGWN3zD3RJ3bYShu/y dY63gmPqp8Np2WjDGBd1/2lvQsznMSgJ1e3PJpZm+gIXJoMK3WfPeNy1iyj3LnuhEWD8 oY5njYCa/xPqGv8AE0C+u6KCqy4T8GwrhAuSSAPU8q5AnpDG/hiuhmZI7SPist+YQJRJ 25Chk+tsOCV9hqGxMYn7d4+vApQsr7i/aZW6WbnL/2ecTI302uQ5K6H2aVHabSN6SeHT y7psfUsxVp48Z1vRW4bVZyG00Ezh1xPV0yjgF5TqRkPFcYyeGZOU2YDTjq58TH6dW5Li 0uZw== 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=cE+1z0Fmkvo9VM+HNd4YEpp1HjHZW628cBVTSxN7K6c=; b=APnWddXgKC7wXGe8BXt98RHAqevvjG+fGOxLOdldruzURwq8nBD+TIvO2z9LnegH1B xCQcnDjECjRUnetEAToJtffC78a2CgLAIfqKwZ9P48KmR1Iem6PN+Sg02w9M/VyGLsOa UThZHLrsSr/XoYRGj78Qg927HMKP5N1Wf06gdpCFiYWFH+PGGACFuOPbLf/xN3gTmUf9 aZBzkA3PF0WvCG9uZ6ZL2B6HRgehCPFdPsWHi3ZvLDhia3qq8lf3QKYvuu1YqAr6Mt9d 04xW6d3upBZalwPbaEdMXdAWj3sIqWOuBhih2DjaLULcRXq3IJhS3hn6PAsre7Qlr8ub FUBw== X-Gm-Message-State: APjAAAXZQ5D+gUGrtGCPQQakUG+hzie/04Eh+xucmk2Y74VWCSTIoSAb diVWPG+Y9GqgKdXxvC0oQ4hztT5HG7GSGW/2OgA= X-Google-Smtp-Source: APXvYqwUl3AXe9dLEm4fhcOpW0KdE+iXaj5SZqXcTjreZjBpJ9IYtMC/2K75PgDg9Cvtinmbks8/EwETQBLp7MtyASA= X-Received: by 2002:a17:906:948e:: with SMTP id t14mr12968305ejx.123.1578607466679; Thu, 09 Jan 2020 14:04:26 -0800 (PST) MIME-Version: 1.0 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> In-Reply-To: <032B5597-6CB6-4F5E-BDDC-8A508C3FCE93@newclarity.net> Date: Thu, 9 Jan 2020 19:04:15 -0300 Message-ID: To: Mike Schinkel Cc: Kalle Sommer Nielsen , Ralph Schindler , Internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] [RFC] Allow ::class on objects From: marcio.web2@gmail.com (Marcio Almada) About the proposal itself of allowing `($expression)::class`, I'd be in favor. > > > Den tor. 9. jan. 2020 kl. 22.41 skrev Mike Schinkel : > > > > Traits are compiler assisted code copy/paste and not contracts (unlike > > interfaces), so there is no gain in having ::trait. > > It can already be referring to using ::class so it makes little sense to disallow ::trait unless there is a different reason not to add another ::keyword. > > Traits are symbols, so it is not unreasonable that there would be a way to access it symbolically so that the reference can be type checked. > > One of my use-cases for referring to traits is to provide helpful hints in error messages, i.e.: > Regarding the inclusion of new keywords with similar behavior of `:class`: 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. 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. And also it would be weird to have `::trait`, `::function` and `::interface` with the same loose behavior as `::class`, in that case, it seems less surprising to have just `::class` everywhere instead.