[Catalyst] Re: PathPart("") v PathPart compared with Path("") v Path
Aristotle Pagaltzis
pagaltzis at gmx.de
Sun Mar 1 14:52:55 GMT 2009
* Tomas Doran <bobtfish at bobtfish.net> [2009-02-28 23:40]:
> We should either allow "PathPart" to work like "Path", or, if
> there is good reason why it needs to be "PathPart('')" (which I
> can't think of, given we have : Local), then "Path" should be
> deprecated to maintain consistency.
It seems to me that `Path` and `PathPart` declare fundamentally
different things, namely the former is a dispatch type while the
latter is just a configuration setting for `Chained`.
It doesn’t make any sense to me that a parameter-less `PathPart`
is accepted at all; it should be an error, IMO.
Also IMO, bare `Path` should mean the same as repeating the
action sub name, eg. for `sub foo` it would mean the same as
`Path('foo')`. This is just what `Chained` without a `PathPart`
does. But of course that ship has long sailed and we’d have to
break backcompat to change it now, so it’s not feasible.
However, is there any reason why the `PathPart` has to be spelled
out so verbosely for chained actions? In `Path` dispatch, you
declare the local path right there as an attribute parameter; why
not make `Chained` like that as well? Ie. the `Chained` attribute
could simply take an optional second parameter, so that this…
sub view : Chained('item') PathPath('') { ... }
… could instead just be this:
sub view : Chained('item', '') { ... }
And if you write this…
sub view : Chained('item') { ... }
… then you get the same as now, ie implicitly this:
sub view : Chained('item', 'view') { ... }
This change would be completely backwards compatible, would cost
nothing in terms of expressivity, and would make it much easier
to write and a lot less noisy to read chained actions.
Regards,
--
Aristotle Pagaltzis // <http://plasmasturm.org/>
More information about the Catalyst
mailing list