On Mon, Nov 11, 2002 at 11:48:06PM -0600, Me wrote: : Are placeholders only usable with anonymous : subs, or named subs too?
Placeholders are not intended for use with named subs, since named subs have a way of naming their parameters in a more readable fashion. However, it may well fall out that if you say sub foo { $^b <=> $^a } it would effectively mean the same thing as sub foo ($a, $b) { $b <=> $a } But note that there's no placeholder equivalent for a forward declaration: sub foo ($a, $b) { ... } : Switching briefly to currying, can one curry : a method? Hmm. We can allow what makes sense. I suppose a class should be allowed to curry one of its own methods on any non-invocant parameter, since that's just equivalent to defining a new method in the same class. (Generally, outside of a class, if you want to make the signatures of the methods look different, the standard way is to derive a new class.) Currying on the invocant is different, since it essentially turns a method into a subroutine, and treats a class as a mere module. This could be construed as antisocial. However, as a special case, one might often want to curry a set of methods to assume a particular invocant. But the syntax for that should probably involve the class rather than the individual methods. Saying use DB_Connection.assuming(self => new DB_Connection) could import all of DB_Connection's public methods into the current class or module as subroutines, and then you don't have to do the sort of I'm-a-class-no-I'm-a-module shenanigans that modules like CGI currently do. Larry