[stringtemplate-interest] Multimethods

Terence Parr parrt at cs.usfca.edu
Tue Nov 11 09:39:07 PST 2008


On Nov 10, 2008, at 10:46 PM, Roman Odaisky wrote:

> On Monday, 10.11.2008 19:34:33 Terence Parr wrote:
>
>> Is there a string you can pass to a renderer that can be broken apart
>> to compute the proper URL? If the URL is truly computation, then it
>> must be a part of the controller; the controller does the mapping of
>> URL to executable code. This is case, then it would violate MVC
>> separation to compute URLs in the view.
>
> I need a way to say, “Here I need a link to a page that would refer  
> to X and
> Y”. Something like <a href="$blog_posts(y=2008, m=2, d=8)$"> that  
> would
> result in .../2008/02/08/... or .../2008-02-08/... or something else
> depending on configuration.
>
>
> To me this looks very declarative and not violating anything.

Yep, unless you compute.  That should work if blog_posts can just  
paste things together.  if it computes or has logic, must be in  
controller.

Ter


More information about the stringtemplate-interest mailing list