[Catalyst] Re: Private Chained Actions?

Aristotle Pagaltzis pagaltzis at gmx.de
Sun Jun 22 17:56:04 BST 2008


* Jonathan Rockway <jon at jrock.us> [2008-06-22 15:35]:
> * On Fri, Jun 20 2008, Aristotle Pagaltzis wrote:
>> That’s even uglier. Imagine there isn’t just `hello` but half
>> a dozen other methods all sharing the same setup. So the setup
>> code is one or two screens down the source file. Now when you
>> look at `hello` you have absolutely no indication whatsoever
>> that there might be other code running before it.
>
> I guess. But this is Perl, there's never any indication of
> anything. There's no indication that my function is receiving
> arguments of a particular type.

Except, y’know, the code in the method body that’s *right there*.

> There's no indication that my function throws exceptions.

I hope you’re not using exceptions for standard control flow.

> There's no indication that "use Foo" has side effects.

Yes, and that causes no end of intermittent trouble. Ovid had
some recent posts on use.perl about getting bitten hard.

> Even in Catalyst, there is a ton of implicit behavior. There is
> no indication that begin/end/auto applies to my action (at
> least until the action runs).

Except, method modifiers are explicit, not implicit – just
defined at a distance, the way you wrote it. In contrast, if you
use Catalyst you know that there may always be begin/end/auto
actions.

I mean, if you have to write out your intent to modify a method
anyway, why not also put that next to the code that will actually
be affected?

I recommend Schwern’s recent “Skimmable Code” talk.

Note well, I’m not arguing against method modifiers in general.

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>



More information about the Catalyst mailing list