[Petal] [PATCH] Options via constructor rather than
package globals
Steve Purkis
spurkis at mkdoc.com
Thu Jun 5 16:02:05 BST 2003
On Thursday, June 5, 2003, at 01:24 pm, Grant McLean wrote:
>>> 2. cascade-able accessor methods which let you do:
>>>
>>> $template
>>> ->language('fr')
>>> ->input('HTML')
>>> ->output('XHTML');
>> Now I find this really, really useless :)
>> I disagree with the idea of constructing an object that is in
> > an inconsistent state and setting the state afterwards through
> > some strange syntaxic sugar.
>
> I tend to agree with Jean Michel on this one - for exactly the same
> reasons. I have seen it before but don't find it at all intuitive.
I cottoned onto it after reading "Smalltalk Best Practice Patterns".
Excellent idea, IMHO. But to each their own.
>>> Additionally, you might get rid of a lot of cut-n-paste work in
>>> _initialize() by doing something like:
>>>
>>> [snip!]
>
> I actually started out with something a bit like that but the
> exceptions cases started to mount up and I decided the cut-n-
> paste version was clearer (although some of the lines ended up
> uncomfortably long).
Fair enough.
>> It might seem like a bit of a hack but I think it's acceptable and it
>> fits in better with the way Petal was designed to start with. Also,
>> the
>> patch seemed to fail one test...
>
> It was passing all the tests when it left here :-) Did the patch
> apply cleanly? I haven't generated patches much before so I may have
> screwed that up.
I'd say it's prolly just tests doing their job, that's all.
Here's how I generate patches, if that helps:
% diff -ruN Petal-0.92.orig Petal-0.92.new > Petal-0.92.some.patch
-Steve
More information about the Petal
mailing list