Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:22000 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 85820 invoked by uid 1010); 24 Feb 2006 14:56:04 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 85804 invoked from network); 24 Feb 2006 14:56:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Feb 2006 14:56:04 -0000 X-Host-Fingerprint: 195.141.85.117 uf1.search.ch Linux 2.4/2.6 Received: from ([195.141.85.117:35911] helo=verksam.search.ch) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id C5/C1-30574-28E1FF34 for ; Fri, 24 Feb 2006 09:56:03 -0500 Received: from localhost (localhost [127.0.0.1]) by verksam.search.ch (Postfix) with ESMTP id 3B2B63D8019; Fri, 24 Feb 2006 15:55:58 +0100 (CET) Received: from unknown by localhost (amavisd-new, unix socket) id client-XXLuweWn; Fri, 24 Feb 2006 15:55:57 +0100 (CET) Received: by verksam.search.ch (Postfix, from userid 65534) id 677513D804D; Fri, 24 Feb 2006 15:55:57 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on verksam.search.ch X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 Received: from [192.168.1.72] (ultrafilter-i [192.168.85.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by verksam.search.ch (Postfix) with ESMTP id 8B45E3D8019; Fri, 24 Feb 2006 15:55:56 +0100 (CET) Message-ID: <43FF1E7C.4000609@cschneid.com> Date: Fri, 24 Feb 2006 15:55:56 +0100 User-Agent: Mozilla Thunderbird 1.0.6 (X11/20060129) X-Accept-Language: en-us, en MIME-Version: 1.0 To: php@karsites.net Cc: internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at search.ch Subject: Re: using $this-> implicitly inside same class From: cschneid@cschneid.com (Christian Schneider) php@karsites.net wrote: > I really do not see the need to keep telling php I'm > refering to the properties and method of the class I'm > already in, when php 5 should be able to deduce this from > the context of the class I'm coding in. This would turn all local variables into global ones in regards to an object instance. One of the big benefits of PHP is that the default for variables is that they are local, you never have side-effects unless you specify it, i.e. you can safely introduce local variables without clashing with properties or global variables. Without $this-> you'd have to either ensure manually that you never have name clashes or introduce a declaration for local variables a la "my $var" in Perl. Neither is desirable. Ruby chose to replace "this->" by "@" but the basic concept is the same as in PHP. Bottom-line: While you're proposal seems to improve the simple case it would introduce a big draw-back for everything a bit more complex, i.e. where you have temporary local variables - which isn't _that_ far fetched :-). - Chris