Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:63690 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26920 invoked from network); 28 Oct 2012 11:40:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Oct 2012 11:40:19 -0000 Authentication-Results: pb1.pair.com smtp.mail=lester@lsces.co.uk; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=lester@lsces.co.uk; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lsces.co.uk from 213.123.26.184 cause and error) X-PHP-List-Original-Sender: lester@lsces.co.uk X-Host-Fingerprint: 213.123.26.184 c2beaomr06.btconnect.com Received: from [213.123.26.184] ([213.123.26.184:55824] helo=mail.btconnect.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3A/45-18930-0A91D805 for ; Sun, 28 Oct 2012 06:40:17 -0500 Received: from host81-138-11-136.in-addr.btopenworld.com (EHLO _10.0.0.5_) ([81.138.11.136]) by c2beaomr06.btconnect.com with ESMTP id JSY86367; Sun, 28 Oct 2012 11:40:13 +0000 (GMT) Message-ID: <508D1998.6020200@lsces.co.uk> Date: Sun, 28 Oct 2012 11:40:08 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120826 Firefox/15.0 SeaMonkey/2.12 MIME-Version: 1.0 To: internals@lists.php.net References: <508A67E6.2000405@zerocue.com> <508A9AC9.50200@sugarcrm.com> <508AF3E7.7020004@sugarcrm.com> <508B1EA2.8060203@sugarcrm.com> <508C249D.1000309@zerocue.com> <508C43ED.9000209@sugarcrm.com> <508C80C6.9000008@zerocue.com> <508CD916.1070509@sugarcrm.com> In-Reply-To: <508CD916.1070509@sugarcrm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Mirapoint-IP-Reputation: reputation=Fair-1, source=Queried, refid=tid=0001.0A0B0302.508D199B.0096, actions=TAG X-Junkmail-Premium-Raw: score=7/50, refid=2.7.2:2012.10.28.110915:17:7.944, ip=81.138.11.136, rules=__MOZILLA_MSGID, __HAS_MSGID, __SANE_MSGID, __HAS_FROM, __USER_AGENT, __MOZILLA_USER_AGENT, __MIME_VERSION, __TO_MALFORMED_2, __TO_NO_NAME, __BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT, __CT, __CT_TEXT_PLAIN, __CTE, __ANY_URI, __URI_NO_MAILTO, __URI_NO_WWW, __CP_URI_IN_BODY, BODY_ENDS_IN_URL, BODY_SIZE_3000_3999, __MIME_TEXT_ONLY, RDNS_GENERIC_POOLED, HTML_00_01, HTML_00_10, BODY_SIZE_5000_LESS, RDNS_SUSP_GENERIC, RDNS_SUSP, BODY_SIZE_7000_LESS X-Junkmail-Status: score=10/50, host=c2beaomr06.btconnect.com X-Junkmail-Signature-Raw: score=unknown, refid=str=0001.0A0B0204.508D199D.011E:SCFSTAT14830815,ss=1,re=-4.000,fgs=0, ip=0.0.0.0, so=2011-07-25 19:15:43, dmn=2011-05-27 18:58:46, mode=multiengine X-Junkmail-IWF: false Subject: Re: [PHP-DEV] [RFC] Property Accessors v1.2 : Internal Accessor Method Visibility / Callability From: lester@lsces.co.uk (Lester Caine) Stas Malyshev wrote: >> By accessors I am simply referring to getters, setters (and in the case >> >of php, issetter and unsetter). > I wish it was so, but it was mentioned many times in this discussion > that "accessors should be accessors" and that only the situation where > accessors are special functions that are not defined as regular methods, > are not callable and are hidden from reflection, etc. is the situation > where "accessors are accessors". This is not the case in Python, Ruby, > MS C++, D and Delphi by your own link - in all these cases, the > properties are defined as regular methods (possibly with some special > salt added) and no special effort is taken to hide them from any of the > language facilities and make them not callable. While I will probably be shouted down again ... can we clarify WHAT people are trying to achieve here? __get and __set simply provide a crude means of using '$data' array to store properties in an object without having to define and load them every time. It has very limited use and in my own opinion is simply wrong anyway. But people seem to like to use it rather than simply defining their own $data array and accessing it directly? The reason it does not work for me is that I populate the data array ( in my case $mInfo ) directly from the persistent data in a database, and __get and __set simply do not work with this so never get used. I can SEE the logic behind a get and set arrangement being 'formalised', and mirroring __get and __set is obviously necessary, but part of the reason for this discussion was - I thought - a way of allowing get/set to manage access to internal data that may not be a simple mirror, but rather calculated from other internal data ( hours based on second count )? 'Internal Accessor Method Visibility' needs to provide the user with information on how a returned value was generated? Even if that is only via documentation? Debugging that the process is working is the thing that gets difficult if you can 'see' the process. The discussion has been 'split up', but I see 'Extra shorthand declaration' as another hiding of visibility such that 'public DateTime $date;' completely bypasses setting up the DateTime object and that $date will have it's own 'accessors' or rather methods for accessing and configuring the object and it's values! PHP has something no other language has - 'very flexible arrays' - and we can manage and pass data very nicely using these properly. Pass by reference allows complex data to be passed and massaged in a way that 'accessors' simply can't provide, and it's this method of working that we should be promoting rather than trying to hide things 'because the user does not need to know about them'. Everything used to be nicely visible in PHP, but that is becoming less the case and getting back to a framework where the IDE can provide all of the 'eye-candy' that is not needed when simply running the scripts should be considered as well? -- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk