[Ur] Invalid Link expression (again)
Sergey Mironov
grrwlf at gmail.com
Thu Aug 8 16:33:40 EDT 2013
On 02/27/2013 04:55 PM, Benjamin Barenblat wrote:
> > I've tried changing 'makeLink' to work on arbitrary names, as long as
> > the record only has one.
> >
> > fun makeLink [nm ::: Name] (r : { nm : (unit -> transaction page) }) : xbody =
> > <xml>
> > <a link={r.nm ()}>call</a>
> > </xml>
> >
> > fun main () =
> > return<xml>
> > <body>
> > {makeLink { Target = main }}
> > </body>
> > </xml>
> >
> > However, attempting to compile this yields
> >
> > test.ur:3:15: (to 3:22) Invalid Link expression
> > Expression UNBOUND_0.UNBOUND_0 {}
> >
> > I have no clue what's going on here. What does "Invalid Link
> > expression" mean?
> >
>
> Ur/Web URLs are generated based on the names of functions that are
> called, so the compiler is fussy about expressions used to describe link
> targets. Currently, the rules in place don't support polymorphic
> functions. You could turn [makeLink] into a functor, with an input
> module containing [nm] as a parameter but an output module containing
> just a non-polymorphic function, and things would work.
Hi. I've run into the same problem when passing link generator as an
argument (see 'template' function at [1]). Is there any way to help Ur
in generating correct link without using functors? Maybe build <a></a>
explicitly using xml values like
fun makeLink f =
let a = xml ... black magic .. in a
[1] - https://github.com/grwlf/foocms/blob/master/tst/room2/main.ur
Regards,
Sergey
More information about the Ur
mailing list