Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:29807 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 94719 invoked by uid 1010); 26 May 2007 14:35:24 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 94704 invoked from network); 26 May 2007 14:35:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 May 2007 14:35:24 -0000 Authentication-Results: pb1.pair.com smtp.mail=greg@chiaraquartet.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=greg@chiaraquartet.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain chiaraquartet.net from 66.79.163.178 cause and error) X-PHP-List-Original-Sender: greg@chiaraquartet.net X-Host-Fingerprint: 66.79.163.178 bluga.net Linux 2.5 (sometimes 2.4) (4) Received: from [66.79.163.178] ([66.79.163.178:37732] helo=mail.bluga.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C0/63-61477-AA548564 for ; Sat, 26 May 2007 10:35:22 -0400 Received: from mail.bluga.net (mail.bluga.net [127.0.0.1]) by mail.bluga.net (Postfix) with ESMTP id 65ACD873DB; Sat, 26 May 2007 07:37:40 -0700 (PDT) Received: from [192.168.0.106] (CPE-72-133-60-138.neb.res.rr.com [72.133.60.138]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.bluga.net (Postfix) with ESMTP id 047CC87362; Sat, 26 May 2007 07:37:39 -0700 (PDT) Message-ID: <465845F9.8010209@chiaraquartet.net> Date: Sat, 26 May 2007 09:36:41 -0500 User-Agent: Thunderbird 1.5.0.10 (X11/20070306) MIME-Version: 1.0 To: Arnold Daniels CC: internals@lists.php.net References: <2C.70.31507.8DE18564@pb1.pair.com> <465820AB.7030102@gmail.com> <465829C0.8060008@mediawave.nl> <465837F7.1000401@adaniels.nl> In-Reply-To: <465837F7.1000401@adaniels.nl> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV using ClamSMTP Subject: Re: [PHP-DEV] $var::$static From: greg@chiaraquartet.net (Gregory Beaver) Arnold Daniels wrote: > Hi, > > I agree that $this::$var isn't really logical, since $this is an object > and not a class name. But I do not see why $class::$var shouldn't work, > or $class::$method() for that method. You can also do $function(). > > Also I want to suggest that brackets can be used more freely. Currently > you can use ${$group . '_myvar'}, but you can't do the same for > functions and classes. It would be great if you could use {$group . '_' > . $fn}() and {get_class($this)}::$var. > > The way to solve this problems right now is to use eval('return ' . > get_class($this) . '::$var;') for getting the value. Getting a reference > to the variable to set it, is even more messy. You need to do something > like eval('$cvar =& ' . get_class($this) . '::$var;'); $cvar = 'bye';. > > Anyway, it is not so nice, but doable in user space fairly easily. So I > don't see why anything needs to be added in PHP 5. It would be nice to > have a better method in PHP 6 though. > > From Holland with love, > Arnold Hi Arnold, As for get_class($this)::$var it pays to search the mailing list archives. the static:: keyword is being using in PHP 6 to do exactly what you want from within a class. Outside of a class, $var::$value doesn't work yet, but the implementation of static may make it possible to implement $var::$value as well. Greg P.S. The list archives are http://marc.info/?l=php-dev and are searchable