Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85971 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 59131 invoked from network); 27 Apr 2015 17:29:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Apr 2015 17:29:00 -0000 Authentication-Results: pb1.pair.com smtp.mail=ua.san.alex@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ua.san.alex@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.181 as permitted sender) X-PHP-List-Original-Sender: ua.san.alex@gmail.com X-Host-Fingerprint: 209.85.213.181 mail-ig0-f181.google.com Received: from [209.85.213.181] ([209.85.213.181:37333] helo=mail-ig0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 26/79-17556-CD17E355 for ; Mon, 27 Apr 2015 13:29:00 -0400 Received: by igblo3 with SMTP id lo3so67295726igb.0 for ; Mon, 27 Apr 2015 10:28:57 -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=zg4OfJBGn2PE0lfaY3eM0V5aXrVQ3Kx74kRqZh+dxMI=; b=gUbRAp+wF27SdGT6J/OqVBPXSACmYokq5k0KlIKJmUHWtIp1+0jy3tcgirjg9wUSIC ng21k0K8woyGPCs9h5BqJTERraZm7R8Sr2tfnCrrcexz199LwMChHkxqsa25cUZ7evrs sQytd4OTatRlrIXxv54cwR5v8WfVfZbpd1Ut9Fvf8hdOohkqd4dz0EWslvCyJac1alvU Z6ZxHMqyv4hrkak0/A9JpwtRptzj5Mp1of7C1DTq/kv0OMexTOecpLvwzsGBeNZVsHCB Sp+ht+km4N4zWe7dee8LlMFZihDs6L2mdoDectAnk5QCRvEgr1r3BtatP3E6kv2lF+4k Ttzw== MIME-Version: 1.0 X-Received: by 10.43.173.70 with SMTP id ob6mr13622921icc.45.1430155737844; Mon, 27 Apr 2015 10:28:57 -0700 (PDT) Received: by 10.50.238.193 with HTTP; Mon, 27 Apr 2015 10:28:57 -0700 (PDT) In-Reply-To: References: Date: Mon, 27 Apr 2015 20:28:57 +0300 Message-ID: To: Anthony Ferrara Cc: internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Add support $object::class From: ua.san.alex@gmail.com ("S.A.N") > 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... 1. get_class($object) - looks bad and long 2. Illogically - Bar::class valid syntax, $object::class invalid syntax. 3. Function call get_class($object) is slower