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 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php