Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56325 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44374 invoked from network); 14 Nov 2011 14:43:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Nov 2011 14:43:57 -0000 Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.170 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.160.170 mail-gy0-f170.google.com Received: from [209.85.160.170] ([209.85.160.170:60690] helo=mail-gy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3D/64-16941-A2921CE4 for ; Mon, 14 Nov 2011 09:43:55 -0500 Received: by gyg13 with SMTP id 13so5613618gyg.29 for ; Mon, 14 Nov 2011 06:43:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=od931KHOW+L4ClQtt60LP19R31EeRQtABLuy7V899Rs=; b=KV13CuDY+lyJJUYH7EodnbhWwGGQl+hA6IoL7IoP7tdJE9mN4oBeJweEGCjo3D0AE8 Bjd6Kq8n/46DDIaczBfpuZbYLfBol5d1BW4/Qtojc/ZUF9f7hcdFJHytfT+c306ig67N H5+vOTm0R5HsS+AElzTR3x7GjAnba+CxzmoX0= MIME-Version: 1.0 Received: by 10.236.116.9 with SMTP id f9mr15974234yhh.0.1321281832196; Mon, 14 Nov 2011 06:43:52 -0800 (PST) Received: by 10.146.168.7 with HTTP; Mon, 14 Nov 2011 06:43:52 -0800 (PST) In-Reply-To: <4EC0B4B7.4010900@lerdorf.com> References: <4EBF1F70.5090700@ens-cachan.fr> <1321150216.1766.6.camel@guybrush> <1321183356.2528.16.camel@guybrush> <4EBFD032.7050408@ens-cachan.fr> <4EC0B4B7.4010900@lerdorf.com> Date: Mon, 14 Nov 2011 15:43:52 +0100 Message-ID: To: Rasmus Lerdorf Cc: Antoine Delignat-Lavaud , internals@lists.php.net, =?ISO-8859-1?Q?Johannes_Schl=FCter?= Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] [PATCH] Making in_array a language operator From: pierre.php@gmail.com (Pierre Joye) On Mon, Nov 14, 2011 at 7:27 AM, Rasmus Lerdorf wrote: > It could also easily be a step in the wrong direction if it isn't > implemented carefully. Turning interchangeable scalar types into fake > objects could introduce the equivalent of strong typing. Indeed, that's not an easy thing to think about or design. Many cases to clearly document or implement. > Doing: $a=12; echo strlen($a); and getting 2 shouldn't suddenly break if > you do it using $a->length() which means all scalar fake object methods > would be available on all scalar objects regardless of their type. > Otherwise it is just a sneaky way of introducing strict typing and that > would cause a lot of pain for a lot of people. > > And while I know I floated the idea myself a while back, I'm not a fan > of scalar objects at all. It's not like it cleans up the global > namespace any, and given the requirement to maintain interchangeable > basic scalar types it doesn't even provide clean per-scalar namespaces > since all the methods would have to be in one. They don't or shouldn't be object per se, it would be too slow somehow. It won't cleanup the global namespace as there will have no gain to drop the other functions, even if they are inconsistent. However that's definitively something I would like to have, as it makes the code cleaner and allows me to stop to have to rtfm for every 2nd scalar related function. But again, it is not a small task nor easy, may never happen as well :) Cheers, -- Pierre @pierrejoye | http://blog.thepimp.net | http://www.libgd.org