Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:67232 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 69770 invoked from network); 30 Apr 2013 23:35:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Apr 2013 23:35:04 -0000 Authentication-Results: pb1.pair.com smtp.mail=adam@adamharvey.name; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=adam@adamharvey.name; sender-id=pass Received-SPF: pass (pb1.pair.com: domain adamharvey.name designates 209.85.210.169 as permitted sender) X-PHP-List-Original-Sender: adam@adamharvey.name X-Host-Fingerprint: 209.85.210.169 mail-ia0-f169.google.com Received: from [209.85.210.169] ([209.85.210.169:43416] helo=mail-ia0-f169.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5E/4D-18873-52550815 for ; Tue, 30 Apr 2013 19:35:04 -0400 Received: by mail-ia0-f169.google.com with SMTP id l29so967852iag.28 for ; Tue, 30 Apr 2013 16:34:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adamharvey.name; s=google; h=x-received:mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=GN9c1xpe5lWVcCvCXegRaAcQ4nZVlqSQxsS/FyQfEfE=; b=wIuTibPpWI74UjBgW9HN8q5r66Va1651uZl6KX5AkR+XfY2C4WdXofIewYBWah93+8 kX2I50Eq2wO7QVf+sLswvuNJGenXbS4iBPrcYvLLC7GbLy/+Q6rvt8Kzz7jbk6EelEw2 1M90Y0f1421yu0L46wUznCVtzYSO+MriItKBs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :x-gm-message-state; bh=GN9c1xpe5lWVcCvCXegRaAcQ4nZVlqSQxsS/FyQfEfE=; b=idCqFPcGyiE5pdgKaOqpdRYndeMFfr+pA9aI7HJgymQ3sY4TOvtyMNG5wS6f/N4pJi IFLpf7YPjpe4BR9VabLb48PVSw4zzlokuWsTF35OLJtXwIivet1ANuK52QGSzxNpPYUe xAVrmK6yC1Ps7IXRzgEwMFZXY2izuU+v2yxPpyr0wzjRcVob0Ysnz1ezcEjSVXOzWsw6 uyFDlJAd6Lrvsk1LgUVxVEyJQq40dmlKph/bkUt8bRLbfEPQSuYS6r8pe0X6qM7Keo1k nSACRV4v5aDAigmQQm2jza4qdTH3Hg1rJrz9sPURmiQ04nMA45Cs6JI8iE3yKcCTcLeZ 1uBg== X-Received: by 10.42.89.7 with SMTP id e7mr328350icm.19.1367364899121; Tue, 30 Apr 2013 16:34:59 -0700 (PDT) MIME-Version: 1.0 Sender: adam@adamharvey.name Received: by 10.42.146.65 with HTTP; Tue, 30 Apr 2013 16:34:39 -0700 (PDT) In-Reply-To: References: <6245ED6B-2BF7-47B7-80C0-D3B3D8E0B312@strojny.net> <51803086.6020002@sugarcrm.com> <518030FD.5030504@lerdorf.com> Date: Tue, 30 Apr 2013 16:34:39 -0700 X-Google-Sender-Auth: 2QKIddipV0l7z1u9my36n5PUI2U Message-ID: To: Rasmus Schultz Cc: PHP internals Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQlKD3xG+CnoINpvwBg7MbHXuZpYorByyKPpSSdPZ0kyYGt1xIE5Sl53TH8lxZ4Nv4fFAcF0 Subject: Re: [PHP-DEV] property de-referencing From: aharvey@php.net (Adam Harvey) On 30 April 2013 16:15, Rasmus Schultz wrote: > At the risk of starting a separate discussion, the recently added > ClassName::class constant provides a way to statically reference a class, > which frankly has very few practical applications in comparison - the need > to reference properties is usually much more prevalent and repetitive than > the need to reference a class; assuming your classes have more than one > property each, heh. The feature as such is also somewhat crippled, since > what comes out of it is a string and not a class-reference. I would caution against generalising use cases. Personally, ::class is something I can use multiple times a day. This I'm not so sure about. Your use case is not my use case, and vice versa. :) > I think there is still a pretty strong case for static property-references, > but since any new language-feature is generally a pretty hard sell around > here, I'm letting this one go for now. Why does this have to be a language feature? It obviously already works in userland, as your own Symfony 2 examples show. One could write a PropertyReference class right now with literally the only difference being the lack of a builtin operator (ie new PropertyReference($obj, 'prop') versus ^$obj->prop): the fact that nobody seems to have done this in a major framework I know of suggests that there isn't a strong need for encapsulating the indirection beyond the $obj->$prop syntax that's worked forever. Adam