Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56319 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 29968 invoked from network); 13 Nov 2011 18:08:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Nov 2011 18:08:56 -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.161.170 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.161.170 mail-gx0-f170.google.com Received: from [209.85.161.170] ([209.85.161.170:33518] helo=mail-gx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 55/A3-07511-8B700CE4 for ; Sun, 13 Nov 2011 13:08:56 -0500 Received: by ggnk4 with SMTP id k4so6351768ggn.29 for ; Sun, 13 Nov 2011 10:08:53 -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:content-transfer-encoding; bh=vmRJh+Rk57LWAFB4j9FB0/hmlJwzhnidftsywEb3/hs=; b=x150IX7K+FLMIbJ0Z/ByeL0pE4pKt0HuDX79hit56HPgJNvafI8s7FJowrYuuz0VhQ H+7rzn7T0ZnuQSH5cS2g9OwVul+8PmKUiE6wkIRP70GPWwKnFr7sIVTG5Rxn/JORMOPw y35QKEyH7UkhxkyZWDC3RxCudkioXpZM8d5T0= MIME-Version: 1.0 Received: by 10.236.190.169 with SMTP id e29mr9699715yhn.110.1321207733852; Sun, 13 Nov 2011 10:08:53 -0800 (PST) Received: by 10.146.168.7 with HTTP; Sun, 13 Nov 2011 10:08:53 -0800 (PST) In-Reply-To: <4EBFD032.7050408@ens-cachan.fr> References: <4EBF1F70.5090700@ens-cachan.fr> <1321150216.1766.6.camel@guybrush> <1321183356.2528.16.camel@guybrush> <4EBFD032.7050408@ens-cachan.fr> Date: Sun, 13 Nov 2011 19:08:53 +0100 Message-ID: To: Antoine Delignat-Lavaud Cc: internals@lists.php.net, =?ISO-8859-1?Q?Johannes_Schl=FCter?= Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [PATCH] Making in_array a language operator From: pierre.php@gmail.com (Pierre Joye) 2011/11/13 Antoine Delignat-Lavaud : > On Sun, 2011-11-13 at 03:10 +0100, Johannes Schl=FCter wrote: please use two replies next time :) > On Sun, 2011-11-13 at 14:23 +0100, Pierre Joye wrote: >> >> There is an idea to have pseudo object for common types, where these >> functions would be callable without actually having an instance. No >> implementation yet so far. > > So this means being able to use $string->strlen() (or even $string->len()= ) > instead of strlen($string) or $array->in_array($x) ($array->in($x)) inste= ad > of in_array($x,$array), right? Yes, that's the idea, but then with obvious names: $string->length(); or $string->length; $array->in($x); instead of reusing the horrible string functions we have right now (needle haystack orders and other (impossible to remember) funny things ;). > That seems like a step in the right direction, with no change to the synt= ax > required. I'll try to see if I can make an implementation of this but I f= ear > it might be a bit more complex than just new language constructors. It is definitively more tricky yes. Cheers. --=20 Pierre @pierrejoye | http://blog.thepimp.net | http://www.libgd.org