develooper Front page | perl.perl6.language | Postings from September 2006

Re: RFC: multi assertions/prototypes: a step toward programming bycontract

Thread Previous | Thread Next
From:
Miroslav Silovic
Date:
September 29, 2006 02:25
Subject:
Re: RFC: multi assertions/prototypes: a step toward programming bycontract
Message ID:
451CE665.3050207@puremagic.com
Aaron Sherman wrote:
>
> In the RFC, I was trying to develop a method by which a module could
> assert a stricture (consider this part of "use strict" in Perl 6 if you
> will) that would constrain the CALLER of that module (as well as the
> module itself, of course) to a particular signature template for a
> multi. This allows us to centrally document a multi that might be
> defined in many places, and have that documentation actively constrain
> the multi to match. In this way, the user doesn't have to figure out
> that max is a method on Array in order to find its documentation, and a
> module that uses Array gets
>

Um, so if I get this right, you want to restrict the users of the module 
from *EVER* extending that particular part of the module's functionality?

I would be strongly opposed to the existence of this feature. Firstly, 
what you propose is not DBC. Design by contract is about requiring 
minimal functionality from the parties in the contract, not about 
banning them from going above the requirements. Secondly, what happens 
when you use two modules with two different prototypes for the same 
multi? Without this declaration, and assuming the modules don't try to 
dispatch on the same argument lists, everything just works. But with 
this stricture, you simply aren't allowed to do this, and I don't see 
any justification for it. Frankly, sometimes things -will- be named the 
same and yes, sometimes you need to use grep to find the docs. Not sure 
why this is a problem, though.

    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