Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91772 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15428 invoked from network); 19 Mar 2016 11:23:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Mar 2016 11:23:22 -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 217.147.176.214 cause and error) X-PHP-List-Original-Sender: lester@lsces.co.uk X-Host-Fingerprint: 217.147.176.214 mail4-2.serversure.net Linux 2.6 Received: from [217.147.176.214] ([217.147.176.214:51532] helo=mail4.serversure.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 63/D6-03097-8A63DE65 for ; Sat, 19 Mar 2016 06:23:21 -0500 Received: (qmail 30131 invoked by uid 89); 19 Mar 2016 11:23:18 -0000 Received: by simscan 1.3.1 ppid: 30123, pid: 30127, t: 0.0729s scanners: attach: 1.3.1 clamav: 0.96/m:52/d:10677 Received: from unknown (HELO ?10.0.0.7?) (lester@rainbowdigitalmedia.org.uk@81.155.186.161) by mail4.serversure.net with ESMTPA; 19 Mar 2016 11:23:18 -0000 To: internals@lists.php.net References: <56EC69EF.1090003@fleshgrinder.com> <56ECCFCB.6090105@garfieldtech.com> <56ED28BD.4040900@fleshgrinder.com> <56ED2FCB.6030609@lsces.co.uk> <56ED31BD.50307@fleshgrinder.com> Message-ID: <56ED36A6.4090201@lsces.co.uk> Date: Sat, 19 Mar 2016 11:23:18 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <56ED31BD.50307@fleshgrinder.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC Discussion] Typed Properties From: lester@lsces.co.uk (Lester Caine) On 19/03/16 11:02, Fleshgrinder wrote: >>> Properties need the ability to be void even after construction and it is >>> >> up to the object to keep track and ensure state. Nullability is imho not >>> >> necessary at all. So we are all in line here. >> > >> > If the record I am working with identifies elements are incorrectly >> > matched, then making a value 'void' is the correct action. We would just >> > NULL that identifier and fire off a delete to the linked record in the >> > database. Otherwise we have to create additional logic to handle that. >> > > And *void* would translate to *unset($record->property)* and not to > *$record->property = null*. This works with the current implementation > and any *isset($record->property)* works too. As you can see, > nullability was not required. :) I did not say what we have now is actually right ... NULL state is simply a mess :) I need '$record->propertyX = null' because the property is part of the data model. Unsetting propertyX so it does not exist means I have to recreate it if I want to add it again, BUT if I am reading a new record from the database I need a variable to put the propertyX into even if that element of the result array is 'NULL'. Going back to 'basics', I have an array of fields ( and using ADOdb rather than PDO I have accurate data on what each field is! ). Initializing the object view of that record I scan each field value and validate the data, or skip it if the field is NULL. Do I need a propertyX if it has no value - in my book yes - so that when building the template to display the data I can include that this does not exist. Could I use 'isset' instead - no - because THAT state says leave out the field from the data display altogether. Could I create some arbitrary default value that is 'not set' ... yes, but that is not how the years of code base has been built! NULL is 'value not set' not 'this variable does not exist' -- 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