Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84112 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 47379 invoked from network); 1 Mar 2015 18:53:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Mar 2015 18:53:12 -0000 Authentication-Results: pb1.pair.com header.from=addw@phcomp.co.uk; sender-id=permerror Authentication-Results: pb1.pair.com smtp.mail=addw@phcomp.co.uk; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain phcomp.co.uk designates 78.32.209.33 as permitted sender) X-PHP-List-Original-Sender: addw@phcomp.co.uk X-Host-Fingerprint: 78.32.209.33 freshmint.phcomp.co.uk Received: from [78.32.209.33] ([78.32.209.33:52269] helo=mint.phcomp.co.uk) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FD/80-42670-61063F45 for ; Sun, 01 Mar 2015 13:53:11 -0500 Received: from addw by mint.phcomp.co.uk with local (Exim 4.72) (envelope-from ) id 1YS8zD-0001GE-44 for internals@lists.php.net; Sun, 01 Mar 2015 18:53:07 +0000 Date: Sun, 1 Mar 2015 18:53:07 +0000 To: internals@lists.php.net Message-ID: <20150301185307.GL15871@phcomp.co.uk> Mail-Followup-To: internals@lists.php.net References: <5E7DF0C5-BCB4-432A-A876-A5057FEBFBB5@gmail.com> <54F320E9.5000706@fischer.name> <61461C0A-4C91-4114-BC71-EF5E743FEBEF@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <61461C0A-4C91-4114-BC71-EF5E743FEBEF@gmail.com> Organization: Parliament Hill Computers Ltd User-Agent: Mutt/1.5.20 (2009-12-10) Subject: Re: [PHP-DEV] Consistent function names From: addw@phcomp.co.uk (Alain Williams) On Sun, Mar 01, 2015 at 05:22:05PM +0000, Rowan Collins wrote: > On 1 March 2015 15:18:09 GMT, "S.A.N" wrote: > >Maybe better implement for method calls on primitive types in PHP 7? > >https://github.com/nikic/scalar_objects > > We'd have a whole bunch of tough decisions to make - does HTML escaping really belong as a method of the string type? What are printf and scanf methods of? Etc > > Without the ability for a user to patch the existing type (a major departure from current classes), you basically still have a bunch of function aliases. What motivation would there be to change dozens of instances of strpos($a, $b) to $a->indexOf($b)? This could be implemented but the existing functions (eg strpos()) could be left. This would set the model for new functions on basic types, etc, to be implemented as methods. If replacing strlen($str) by $str.length is really wanted, then allow a very long cross over time so that people do not need 2 versions of their code: 1 for method calls & the other basic functions. Thus if this were implemented in, say, PHP 7 warnings would be generated by default in PHP 9 and removal in PHP 11. It would, however, almost create a new language ... or what feels like a new language. > In this respect, some version of UString makes more sense, because (if well-defined) it actually gives users some advantage over the current functions. -- Alain Williams Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer. +44 (0) 787 668 0256 http://www.phcomp.co.uk/ Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php #include