Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93815 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 91076 invoked from network); 5 Jun 2016 12:50:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Jun 2016 12:50:09 -0000 Authentication-Results: pb1.pair.com header.from=lester@lsces.co.uk; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=lester@lsces.co.uk; spf=permerror; 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:35678] helo=mail4.serversure.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B9/56-55579-FFF14575 for ; Sun, 05 Jun 2016 08:50:08 -0400 Received: (qmail 10291 invoked by uid 89); 5 Jun 2016 12:50:04 -0000 Received: by simscan 1.3.1 ppid: 10284, pid: 10288, t: 0.0866s 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.138.11.136) by mail4.serversure.net with ESMTPA; 5 Jun 2016 12:50:04 -0000 To: internals@lists.php.net References: <0aa259bf-19c9-61ed-c908-792bf9aef78c@fleshgrinder.com> Message-ID: <57541FFC.4060700@lsces.co.uk> Date: Sun, 5 Jun 2016 13:50:04 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: <0aa259bf-19c9-61ed-c908-792bf9aef78c@fleshgrinder.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC DISCUSSION] typeof From: lester@lsces.co.uk (Lester Caine) On 05/06/16 11:56, Fleshgrinder wrote: > Quick sketch of a ReflectionVariable class: > > https://gist.github.com/Fleshgrinder/40d256a4bf44a0e2579b41d6e92e976e > > What do you think? > > PS: This would definitely be a different RFC! The one thing that sticks out from this is 'why do I need all this?' This may be because I don't understand just what happens under the hood when you create a $var and in my naive way I have ALWAYS assumed that a variable was a set of data elements with a pointer which 'a single compiled and optimized set of code' operated each of to provide either the raw value, or transformed version of that data essentially in a different type. but if the value was provided as a string, that string was maintained. I've never viewed a $var as a single data element, so 'typing' it as int does not mean that it only exists as a fixed length register - probably 64bit - with no other versions stored. If it was provided as a hex string then I would anticipate that both the hex string type will exist in parallel with the binary value. At least a $var has a name field, flags for access restrictions, and yes null fields where they have not be defined. I would expect ALL of the extras listed in 'ReflectionVariable' simply to be core code handling any $var value be that as an element of an enclosing array, a property in a class, or a parameter in a function call. This is why I don't understand the 'strict' mode at all. Or rather I do in relation to a compiled language that does not have the flexibility to pass data from one domain to another and where the typing is directed to specific hardware restrictions which then make optimizing code appropriate, but PHP specifically avoids that problem. It was the major plus when I started using it! I understand that type checking has a place, but NOT as it is currently structured, which is why I think all the current round robins on typing/null/strict are simply going to carry on in that manor. When I create 100 person objects how many copies of the class and related code are created? Is each property then it's own full copy of the var code, which is why you want to 'optimise' for each different type, rather than improving the caching of the objects data to only run a type conversion when it is needed. -- 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