On 23 May 2005, at 15:33, Ian Langworth wrote:
I'm working on a new module, Class::Agreement, and I've started by
writing the documentation. If anyone has a few minutes, I'd like some
feedback as to whether my descriptions of the concepts make sense and
if you like the syntax.
HTML: http://reliant.langworth.com/~ian/Class-Agreement.html
[snip]
Nice. Random comments/niggles.
- It makes sense to me, but I've done DBC and used Eiffel in the
past. I'm not entirely sure it would make sense to somebody who
doesn't already know what DBC is. A full working example that does
something vaguely useful would go a long way to illustrating the
concepts to the newbie. Say a simple stack/queue class.
- A quick mapping onto Eiffel constructs might be nice. I'd
imagine a lot of the people interested in DBC in Perl would have
Eiffel experience. Also a lot of the stuff written about DBC uses
Eiffel - so a quick summary might be useful for Perl folk looking for
more info elsewhere.
- No class invariants?
- You do mention that tweaking @_ in the pre/post blocks will
affect the @_ passed to the method. You don't say that having pre/
posts that have side effects is evil. You probably should :-)
- s/sub g => sub {/sub g {/
- It's not immediately obvious to me from reading the docs that
doing:
{ package SomeSubclass;
use base 'SomeClass'; # from your example
sub choose_word { return -1 };
}
would fail since choose_word should still be bound by the
SomeClass precondition. I'm assuming you're doing something clever
with INIT blocks or something so this does work. What you need to do
with subclasses that have the same contract (if anything) needs to be
made explicit in the docs.
- On "How can I type less?". I'm curious as to whether you
considered adding an automatic $self to match the $r/@r ?
- I'd want a global way of switching off contracts without having
to change the code. $ENV{ClassAgreementDisabled} = 1 or something.
- I had to read "What do you mean, ``There's a problem with the
heirarchy?''" three times. More paragraphs and an example for the
slow of thinking like me please :-)
Cheers,
Adrian