develooper Front page | perl.perl6.language | Postings from March 2005

Re: MMD as an object.

Thread Previous | Thread Next
From:
Miroslav Silovic
Date:
March 10, 2005 06:33
Subject:
Re: MMD as an object.
Message ID:
423037A3.20003@puremagic.com
lt@toetsch.at wrote:

>What about multi subs? They can be defined everywhere. Given:
>
>  multi sub *foo(A $a, B $b) {...}
>
>Is this something like:
>
>  %globals{"foo"}  -->  MultiSub{"foo_A_B" => Sub, ...}
>
>What about a not so global multi:
>
>  multi sub foo(A $a, B $b) {...}
>
>Thanks for clarifying,
>leo
>
>  
>
Uh, the real problem is the interaction between multisubs and modules. 
If you import a multi with the same short name from another module, you 
get a real issue that needs resolving. Especially if they do 
fundamentally different things and you don't expect a clash. Like

module Users;
multi get(Stream $f, UserDescriptor $u) {...}

...

module FileTransfer;
multi get(Server $s, File $f) {...}


Even if this is easy to fix by renaming, the error message would take a 
while to track down and it'd be annoying distraction during development. 
I believe the DWIM thing to do would be to merge multis into the same 
MMD object on module load. This would have to happen during runtime, 
since that's when the module load can occur.

    Miro


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About