Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65290 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77966 invoked from network); 28 Jan 2013 19:29:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Jan 2013 19:29:39 -0000 Authentication-Results: pb1.pair.com header.from=steve@mrclay.org; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=steve@mrclay.org; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mrclay.org from 50.22.11.19 cause and error) X-PHP-List-Original-Sender: steve@mrclay.org X-Host-Fingerprint: 50.22.11.19 bedford.accountservergroup.com Linux 2.6 Received: from [50.22.11.19] ([50.22.11.19:48458] helo=bedford.accountservergroup.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F8/79-28517-1A1D6015 for ; Mon, 28 Jan 2013 14:29:37 -0500 Received: from ip68-101-74-66.ga.at.cox.net ([68.101.74.66]:57394 helo=[192.168.11.20]) by bedford.accountservergroup.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.80) (envelope-from ) id 1TzuOb-000Bym-FX for internals@lists.php.net; Mon, 28 Jan 2013 13:29:33 -0600 Message-ID: <5106D19C.4020506@mrclay.org> Date: Mon, 28 Jan 2013 14:29:32 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 MIME-Version: 1.0 To: PHP Internals Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bedford.accountservergroup.com X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - mrclay.org Subject: Thoughts on "scalar objects" From: steve@mrclay.org (Steve Clay) Re: https://github.com/nikic/scalar_objects Initial impression: This patch reminds me of extending native prototypes in Javascript, with similar limitations that may explain why this has fallen out of fashion in JS. The big one is that allowing change to the prototypes introduces global state with all the problems that implies. The second is that you can't store local state beside the value. E.g. a useful UTF-8 string class would want to store some extra state like: has the string been validated, and are all chars in ASCII. Other ideas: * Instead of registering a single class to wrap a native type, allow users to register handlers that receive the native value, the type, the called method name, and args. This allows altering behavior based on the value/method at call-time. The handler would return a 2 member array: the first would indicate whether the handler actually handled the call, the second would have the return value. * Would it be possible to limit this behavior to a particular scope? Steve Clay -- http://www.mrclay.org/