Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:50776 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77692 invoked from network); 1 Dec 2010 13:22:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Dec 2010 13:22:06 -0000 Authentication-Results: pb1.pair.com header.from=president@basnetworks.net; sender-id=unknown; domainkeys=good Authentication-Results: pb1.pair.com smtp.mail=president@basnetworks.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain basnetworks.net from 208.97.132.66 cause and error) DomainKey-Status: good X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: president@basnetworks.net X-Host-Fingerprint: 208.97.132.66 caiajhbdcagg.dreamhost.com Windows 98 (1) Received: from [208.97.132.66] ([208.97.132.66:56516] helo=homiemail-a75.g.dreamhost.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 46/C2-62427-DFB46FC4 for ; Wed, 01 Dec 2010 08:22:06 -0500 Received: from homiemail-a75.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a75.g.dreamhost.com (Postfix) with ESMTP id 6336A5EC064; Wed, 1 Dec 2010 05:22:03 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=basnetworks.net; h=message-id :in-reply-to:references:date:subject:from:to:cc:mime-version :content-type:content-transfer-encoding; q=dns; s= basnetworks.net; b=D4Q9LfrbjtXq4HTRPPe0nffm9SIgWPxRGx2NXKcRDRoxd umk7y9TeD+MhRwWY3cV2t5c8szfb2e/1V0qKfClCpKd+8hFB7FQU90ISorxEqmDG 7hwxeZhWJThhuX4nmcmtp4XW28Gb8xSfGR344TWpUeTM+UQLMoQBN/p9Rrj5vE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=basnetworks.net; h= message-id:in-reply-to:references:date:subject:from:to:cc :mime-version:content-type:content-transfer-encoding; s= basnetworks.net; bh=55IWDXDNgvrtfIAFr9VnGfnywAw=; b=Gs36z7gH66P2 TnTtEvN01nIclCbq/OyDMb30Js5JE/wHyaAlZmMLdeu7jpf+oCR8BtPvcsCs0+nt bcMjhn/LWq94bJvkCTzbfKdoNJNU+abwGtANPpWirXOYA3uAulMsX4J162Ld0nv5 etX+Jf+yvZDVn4O+EhjhPOFrH6P3S8s= Received: from webmail.basnetworks.net (ahfbbjcaiaae.dreamhost.com [75.119.208.4]) (Authenticated sender: president@basnetworks.net) by homiemail-a75.g.dreamhost.com (Postfix) with ESMTPA id 2FEBA5EC063; Wed, 1 Dec 2010 05:22:03 -0800 (PST) Received: from 70.28.48.126 (proxying for 70.28.48.126) (SquirrelMail authenticated user president@basnetworks.net) by webmail.basnetworks.net with HTTP; Wed, 1 Dec 2010 08:22:05 -0500 Message-ID: <23d1e573d22236bad96d57ffff4e3001.squirrel@webmail.basnetworks.net> In-Reply-To: <4CF613EB.40200@sugarcrm.com> References: <003601cb8fd0$f6494e80$e2dbeb80$@com> <4CF3B855.5010406@sugarcrm.com> <003401cb8fee$1be39840$53aac8c0$@com> <2450924ae03481f5b1382a7f00e5743d.squirrel@webmail.basnetworks.net> <4CF50245.5020807@sugarcrm.com> <4CF5118B.2030300@sugarcrm.com> <1faa4c3db62771335db714507ac2adfa.squirrel@webmail.basnetworks.net> <4CF613EB.40200@sugarcrm.com> Date: Wed, 1 Dec 2010 08:22:05 -0500 To: "Stas Malyshev" Cc: "internals@lists.php.net" User-Agent: SquirrelMail/1.4.21 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] RFC: C-sharp style property get/set syntax for PHP From: president@basnetworks.net >> Its not a matter of consistency - Properties, as a cross-language >> concept >> are not meant to work that way. You need to think of a property as a >> set > > Meant by whom? Is there some law of universe that prevents us from > implementing the feature? Its a defacto standard. Of course there is nothing stopping PHP from implementing properties that way, but by going against the standard set b= y the rest of the industry, it is very confusing for programmers coming fro= m other languages to learn PHP. A good example is how "=3D=3D" works differently in PHP than in other languages. In PHP, "=3D=3D=3D" works li= ke "=3D=3D" does everywhere else. "(string)'0' =3D=3D (int)0", for example is true i= n PHP, but false in most other languages. I have had countless conversations with PHP developers who claim the language is "broken", because =3D=3D does not work like they expect it to, after which I have t= o explain =3D=3D=3D to them. This is because PHP goes against the defacto standard. Maybe it would have been better if =3D=3D and =3D=3D=3D had th= e opposite meaning, as to not squash the standard? >> of two methods that just have a pretty syntax. Methods cannot be unse= t, >> and nor should properties be allowed to. isset() should simply tell u= s >> whether a property with the specified name is part of the class or not= . > > If you need methods, why not use methods? Because properties are only meant to be a pretty syntax for a get/set method. Thats it! I don't know of any other special behaviour in any other language that lets you "hide" properties or anything else like that= . >> isset() in the way you suggest would just be confusing. It would allo= w >> is >> to say that a property does not exist, when in fact it does exist. Th= is >> is not logical. > > Sorry, from your answer I don't understand - what happens when you call > isset($foo->property) and unset($foo->property)? You make a good point. If we can't unset a property, than we lose consistency with regular variables which I guess ruins the point of properties. - Dennis