[Catalyst] Re: [again] die() in an action chain : does not break the chain !

Aristotle Pagaltzis pagaltzis at gmx.de
Sat Mar 15 09:28:10 GMT 2008


* Ashley <apv at sedition.com> [2008-03-15 06:15]:
> While we're on the topic. How abhorrent/stupid is this?
>        $c->die();
>    # or
>        $c->die("Dying is easy, comedy is hard");
>
> I'd really like something like this. I could go for $c->fatal()
> too. fatal_error() is nice and descriptive but I lean toward
> something shorter if it can be agreed upon.

FWIW, I based it on the feel of `error_out`.

> It should convey, /somehow/, that it's circumventing further
> processing excepting the end. "die" feels intuitive and is
> super easy to type but it seems too loaded.

At first I was going to suggest `abort`. It’s too ambiguous tho:
the verb is both transitive and intransitive, and it’s not clear
that the latter sense is meant. Also if used transitively it’d be
unclear whether it’s like `forward`/`detach` in that it takes an
action, or if it expects a different kind of argument. It would
have to be `abort_with_msg` or something; but that’s a good deal
worse than `fatal_error`.

Then I thought of `fail`. That does not suffer from these
problems and is almost as short as `die`. It’s somewhat loaded,
though, even though in a very different way from `die`
(particularly for Perl programmers). Not every case where one
wants to abort the request processing is a failure.

That would suggest something like `stop`. But that has much the
same linguistic ambiguity problems as `abort`, if not to the same
degree (because it doesn’t have quite as many connotations in
programming as `abort`). But it says a little too little about
what is being stopped. It’s not necessarily clear that it means
stopping the request processing as opposed to stopping whatever
else one might stop.

Maybe `quit`? The problem with that is that it suggests that the
Cat app terminates altogether. Other than that it would seem like
a good candidate, because I think the connotation of quitting in
computing makes it quite clear that this wouldn’t expect an action
as an argument, say.

Which brings me to `halt`. As far as I can tell, that suffers
from none of the problems with any of the other options. It has a
strong connotation of “halt processing” in computing and it’s
very clear that it is intransitive, and unlike `fail` it doesn’t
make a strong suggestion about whether the outcome is desirable,
although it is negatively connoted.

As a bonus, it’s word you can imagine a burly German yelling.

Suggested plugin name: HaltRequest

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



More information about the Catalyst mailing list