Re: Multisubs and multimethods: what's the difference?

2006-03-02 Thread Jonathan Lang
Larry Wall wrote: A multi sub presents only an MMD interface, while a multi method presents both MMD and SMD interfaces. In this case, there's not much point in the SMD inteface since .. used as infix is always going to call the MMD interface. So: multi method : MMD and SMD multi sub: MMD

Separate compilation and compile-time things

2006-03-02 Thread Zohar Kelrich
We were discussing some confusing macro behaviours, when we came upon this curious thing. This code is really simple in p5, as it doesn't really have separate compilation, but in p6, the modules can be pre- compiled or cached. 8-- module ImportHeadache; my $m; sub

Re: Separate compilation and compile-time things

2006-03-02 Thread Yuval Kogman
One way to think of your macro example (instead of the -import one, which is harder to define, i think): Every time you use a module it's used by the compiler, and by the emitted code. The compiler loads the macros, the emitted code loads the non-macro stuff. Since the clsoure is created in the

Re: Separate compilation and compile-time things

2006-03-02 Thread Yuval Kogman
On Thu, Mar 02, 2006 at 15:13:07 +0200, Zohar Kelrich wrote: We were discussing some confusing macro behaviours, when we came upon this curious thing. This code is really simple in p5, as it doesn't really have separate compilation, but in p6, the modules can be pre- compiled or cached.

Re: Multisubs and multimethods: what's the difference?

2006-03-02 Thread Stevan Little
On 3/2/06, Jonathan Lang [EMAIL PROTECTED] wrote: Can subs be declared within classes? Can methods be declared without classes? If the answers to both of these questions are no, then it occurs to me that you _could_ unify the two under a single name, using the class boundary as the

Fwd: Multisubs and multimethods: what's the difference?

2006-03-02 Thread Jonathan Lang
Stevan Little wrote: Jonathan Lang wrote: Can subs be declared within classes? Can methods be declared without classes? I would say yes. Having subs inside classes makes creating small utility functions easier. You could also use private methods for this, but if I dont need to pass the

Re: Multisubs and multimethods: what's the difference?

2006-03-02 Thread Stevan Little
On 3/2/06, Jonathan Lang [EMAIL PROTECTED] wrote: Stevan Little wrote: Jonathan Lang wrote: Can subs be declared within classes? Can methods be declared without classes? I would say yes. Having subs inside classes makes creating small utility functions easier. You could also

Re: Multisubs and multimethods: what's the difference?

2006-03-02 Thread Jonathan Lang
Stevan Little wrote: Jonathan Lang wrote: Steven Little wrote: $object does unattached_method; ^Object does unattached_method; (Wouldn't that be ^$object does unattached_method;?) No, I am attaching the method (well role really) to the class ^Object. There is no such thing as