in reply to [Perl 6] auto subs from methods?
So you can also presumably curry the invocants of all the methods:(use IO::Logging).assuming(logfile => ".log");
Note however that this is much better than merely forcing the class to carry its own default object. Instead, we encourage the user module to declare its own default object and use that, which means that different modules can have different default objects, each lexically scoped to its own module. You can still have a global default object if you like, but all the modules that want to use that global default object will have to explicitly declare that that is what they want, rather than being forced to share whether they want to or not.constant $defobj = ...; (use Some::Class).assuming($defobj:);
The particular syntax given above is a bit problematic in several ways, but even if the syntax changes, the principle will remain that you'll be able to use some form of currying to supply an aliased view of a module or class, and that mechanism will certainly allow you to curry the invocants of a class, essentially turning a class of methods into a module of subs that assume the curried invocant.
In any case, this is not a terribly new idea: the currying of classes into modules was already explicitly mentioned in A06 back in 2003.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: [Perl 6] auto subs from methods?
by blazar (Canon) on Oct 28, 2007 at 13:14 UTC | |
by TimToady (Parson) on Oct 29, 2007 at 16:30 UTC |