Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85968 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48836 invoked from network); 27 Apr 2015 15:35:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Apr 2015 15:35:58 -0000 Authentication-Results: pb1.pair.com header.from=ircmaxell@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ircmaxell@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.48 as permitted sender) X-PHP-List-Original-Sender: ircmaxell@gmail.com X-Host-Fingerprint: 209.85.215.48 mail-la0-f48.google.com Received: from [209.85.215.48] ([209.85.215.48:36814] helo=mail-la0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CB/D7-17556-D575E355 for ; Mon, 27 Apr 2015 11:35:58 -0400 Received: by lagv1 with SMTP id v1so82929674lag.3 for ; Mon, 27 Apr 2015 08:35:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=V0GPPKgRXH0EpB7eK6+uQdLtSH/VJENBIZeQJP2hpgE=; b=nawFLWFnaiO1r9bjAL4OBNuP8qk/DaRrcr5J6SSFDpyLTjxE4TnLmxrsNv4+NeBn4w BvA0Qlfzbr38UbPX/NYZ0fx/MqNPSNeSK4nuEIN3gjWejAp04oLBAuHDAQaXE9vmmrd3 WrZsx8HqHv5tBoyfYEJhSqFctmfekgnV1Jth6LP5VgJk1HhzMPEiCguxkbqymYm2eloc SwVywFZ5saHo4JEgsMtUcZgj/OE8PS++Vh2UvBZY/amKGs+1M5xJhRzvC945ZnWjvLTO b9xdgg37OWg25AH33Lei8c07hrU014UkvnrXHWVLv0m65Jfer7aRutHj8ieWbVDxeIpg IiPg== MIME-Version: 1.0 X-Received: by 10.112.13.233 with SMTP id k9mr10704319lbc.57.1430148954845; Mon, 27 Apr 2015 08:35:54 -0700 (PDT) Received: by 10.25.90.75 with HTTP; Mon, 27 Apr 2015 08:35:54 -0700 (PDT) In-Reply-To: References: Date: Mon, 27 Apr 2015 11:35:54 -0400 Message-ID: To: "S.A.N" Cc: internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Add support $object::class From: ircmaxell@gmail.com (Anthony Ferrara) On Mon, Apr 27, 2015 at 7:18 AM, S.A.N wrote: > Now this code causes an error PHP 5-7. > > PHP Parse: > Syntax error, unexpected 'class' (T_CLASS), expecting identifier > (T_STRING) or variable (T_VARIABLE) or '{' or '$' > > Do not want to use get_class($object) Why not? Seriously, why not? ::class was added because there was no easy way to get from the symbol class name to the string representation of it (you couldn't pass it to a function, etc since it would look like a constant). So ::class is a purely compile time construct to turn a literal classname into a string representation. However, if you have a variable, there already is a way to do that at runtime: get_class. What's the problem with that where we need to further support arbitrary syntax? Note: I'm not saying we shouldn't add support. I'm just saying that it's not the same situation as with Bar::class... Anthony