dragonchild has asked for the wisdom of the Perl Monks concerning the following question:
package Foo; class { attr qw( foo bar ); method floober => signature ( Int, Int ), body { ... }; };
It's defined as so:
sub class (&) { my ($sub) = @_; $sub->(); # Do some book-keeping in the caller's namespace. }
I would really like to optionally call it as so:
where is() is defined as a syntactic sugar passthrough as so:class 'Foo' is { };
sub is (&) { return @_ }
This would mean that the prototype for class() would have to be ($&), not (&). Is this even possible with P5's borken prototypes?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Prototypes and hand-written MMD (Ah! No!!)
by tye (Sage) on Jan 10, 2006 at 07:46 UTC | |
by dragonchild (Archbishop) on Jan 10, 2006 at 14:08 UTC | |
by diotalevi (Canon) on Jan 10, 2006 at 16:49 UTC | |
|
Re: Prototypes and hand-written MMD
by PodMaster (Abbot) on Jan 10, 2006 at 04:24 UTC | |
|
Re: Prototypes and hand-written MMD
by ysth (Canon) on Jan 10, 2006 at 08:25 UTC | |
|
Re: Prototypes and hand-written MMD
by ph713 (Pilgrim) on Jan 11, 2006 at 01:36 UTC | |
by ysth (Canon) on Jan 11, 2006 at 19:14 UTC | |
by xdg (Monsignor) on Jan 11, 2006 at 20:20 UTC | |
by ysth (Canon) on Jan 11, 2006 at 20:47 UTC | |
by BrowserUk (Patriarch) on Jan 12, 2006 at 00:01 UTC | |
| |
by dragonchild (Archbishop) on Jan 12, 2006 at 00:41 UTC | |
by diotalevi (Canon) on Jan 11, 2006 at 20:29 UTC |