Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53126 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 34317 invoked from network); 7 Jun 2011 10:40:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Jun 2011 10:40:29 -0000 Authentication-Results: pb1.pair.com header.from=johannes@schlueters.de; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=johannes@schlueters.de; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain schlueters.de from 217.114.211.66 cause and error) X-PHP-List-Original-Sender: johannes@schlueters.de X-Host-Fingerprint: 217.114.211.66 unknown Received: from [217.114.211.66] ([217.114.211.66:60100] helo=config.schlueters.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D3/A0-30784-1100EED4 for ; Tue, 07 Jun 2011 06:40:18 -0400 Received: from [192.168.2.230] (ppp-93-104-51-187.dynamic.mnet-online.de [93.104.51.187]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by config.schlueters.de (Postfix) with ESMTPSA id 86E2172469; Tue, 7 Jun 2011 12:40:14 +0200 (CEST) To: Lars Strojny Cc: internals@lists.php.net In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Date: Tue, 07 Jun 2011 12:40:13 +0200 Message-ID: <1307443213.1894.848.camel@guybrush> Mime-Version: 1.0 X-Mailer: Evolution 2.30.2 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Implementation help needed: Currying RFC From: johannes@schlueters.de (Johannes =?ISO-8859-1?Q?Schl=FCter?=) On Mon, 2011-06-06 at 01:28 +0200, Lars Strojny wrote: > I¹ve finally found some time to put together a first draft of an RFC for > currying (https://wiki.php.net/rfc/currying). This is basically meant as a > starting point to find a clean and concise syntax for PHP. So, if you > kinda like what you¹ve read or you think it¹s crazy or anything in > between, drop me a message. I wonder how your proposal would work with a variable number of arguments. Taking a piece out of your RFC: $apos = curry strpos(..., 'a')); Would the parameter always be appended? So what would happen here: $apos(); // runtime error wrong param count? $apos("bar"); // fine $apos("bar", "foo"); // 'a' casted to long, used as offset? $apos("bar", "foo", 0); // run-time error wrong param count? I feel that this won't fit easily in the language, while the feature itself can be nice with all these callback things. I also don't know if it can be implemented in an efficient way. A simple way to implement is to create a closure. (which has performance impacts and misleading error messages in the cases shown above) I also think that Keyword curry should have an alias schoenfinkel should not be the case. It is nice to remember some people and such but I think this alias is just one more thing to know when reading code but serves no real purpose. I know the concept mostly as currying, Scala for instance seems to always reference it as currying. johannes