It should be possible to abstract over page and template calls.

For example, the pageIndex template, should redirect to the last page in the index if the index is larger than the number of pages. Simplified:


define pageIndex(index: Int, pages: Int, nav: Int -> Link) {
init{
if(index > pages) { goto nav(pages); }
}
// …
}

define blog(b: Blog, index: Int) {
var pages := …
// …
pageIndex(index, pages, fun(idx){ navigate blog(b, idx) })
}

The syntax is just a sketch and needs some more thought.

Submitted by Eelco Visser on 12 May 2011 at 13:41

Log in to post comments