Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:50781 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88811 invoked from network); 1 Dec 2010 14:01:13 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Dec 2010 14:01:13 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@stefan-marr.de; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=php@stefan-marr.de; sender-id=unknown Received-SPF: error (pb1.pair.com: domain stefan-marr.de from 85.88.12.247 cause and error) X-PHP-List-Original-Sender: php@stefan-marr.de X-Host-Fingerprint: 85.88.12.247 toolslave.net Received: from [85.88.12.247] ([85.88.12.247:60588] helo=uhweb12247.united-hoster.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EF/E4-62427-9F456FC4 for ; Wed, 01 Dec 2010 09:00:28 -0500 Received: from [134.184.43.20] by uhweb12247.united-hoster.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1PNnDx-0005ms-Ag; Wed, 01 Dec 2010 15:00:00 +0100 Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=windows-1252 In-Reply-To: Date: Wed, 1 Dec 2010 14:59:56 +0100 Cc: "Stas Malyshev" , "internals@lists.php.net" Content-Transfer-Encoding: quoted-printable Message-ID: <150497B4-DCA3-4042-BE64-6EA6C4C1A0A4@stefan-marr.de> 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> <6EC3583E-E7B7-431D-B544-82135A33E351@stefan-marr.de> To: president@basnetworks.net X-Mailer: Apple Mail (2.1082) Subject: Re: [PHP-DEV] RFC: C-sharp style property get/set syntax for PHP From: php@stefan-marr.de (Stefan Marr) On 01 Dec 2010, at 14:10, president@basnetworks.net wrote: > Unfortunately I find that to be one of the major downfalls of PHP. It > sometimes disregards defacto standards that are set across the entire > industry, which causes a lot of frustration for new programmers.=20 > Sometimes the functionality PHP adds by going its own way is worth it, = but > often it is just a confusing mess. Thats just my opinion though, = YMMV. Still, if it is not consistent in itself it is worse than not following = certain designs which make sense for other languages only. >>> isset() in the way you suggest would just be confusing. It would = allow >>> is >>> to say that a property does not exist, when in fact it does exist. = This >>> is not logical. >> =46rom the docu: isset =97 Determine if a variable is set and is not = NULL >> There is nothing confusing about isset($this->Hours) =3D=3D FALSE in = your >> example if isset($this->seconds) =3D=3D FALSE. >=20 > Right, I understand how it would work, and the reasons why it would = "make > sense", but it just feels wrong to me. When you unset() a variable in = a > class, that whole variable is gone. Its not just hiding somewhere, = its > completely gone. If a property were to "pretend" it is not set, with = an > isset method, it would still be there - just hiding. That is why it = does > not make sense to me. The main problem here is that unset and isset are not symmetric. isset() basically means there is a value. Where unset() destroys the _holder_ of the value. In that sense, unset is special since it works on another level, on the = same level as property_exists(). There are several possible approaches, but the main point here is that = at least isset() still makes sense. property_exists() and unset() should be dealt with carefully in another = way. Best regards Stefan --=20 Stefan Marr Software Languages Lab Vrije Universiteit Brussel Pleinlaan 2 / B-1050 Brussels / Belgium http://soft.vub.ac.be/~smarr Phone: +32 2 629 2974 Fax: +32 2 629 3525