[Ur] Invalid Action expression

Sergey Mironov grrwlf at gmail.com
Fri Aug 1 02:58:41 EDT 2014


Thanks for the explanation. I used forms probably because of my own
old-styled approach to web-development. But I really doesn't strictly
need them. I just wanted to get a try to this Ur/Web mechanism.

By the way, I need to pass a list of <input>'s (of approx. 40 items)
to the server-side. What is the canonical way of doing it? How should
I declare an input without linking it to the form?

Regards,
Sergey

2014-07-22 16:42 GMT+04:00 Adam Chlipala <adamc at csail.mit.edu>:
> Here we have an interesting interaction between the ordering of compiler
> phases.
>
> Ur/Web links (including in <submit> actions) must be calls to named
> functions defined at the top levels of modules, more or less.  While the
> body of [sbm] instead uses a local variable for a link, we know, of course,
> that inlining the definition of [sbm] leads to a concrete function name
> instead.  Unfortunately, the current Ur/Web compiler is not going to inline
> the call, because the phase that does inlining runs after the phase that
> produces URL-generation code!  I think this ordering choice is actually the
> right one, because inlining can change which syntactic function name appears
> in an 'action' attribute, etc., potentially leading to unintuitive behavior
> in URL generation (e.g., a link written as a call to a particular named
> function actually winds up compiled as a call to different named function,
> because of inlining).
>
> Probably the easiest way to implement your abstraction is via a functor,
> using the module system.  Functor applications get inlined fully before
> producing URL-generation code.
>
> Even better, though, could be to stop using 20th-century forms and use
> client-side scripting with <button>, etc., instead!
>
>
> On 07/20/2014 04:08 PM, Sergey Mironov wrote:
>
> Hi! Here is another error I've faced when trying to write a
> styling-wrapper for my submit buttons:
>
> $ urweb -dbms sqlite Submit
> /home/grwlf/proj/urbugs/Submit.ur:21:89: (to 21:90) Invalid Action
> expression
> Expression UNBOUND_0
>
> See the trivial example below. Please, consider fixing! Without
> sbm-like wrappers I am forced to repeat submit code from form to
> form..
> Regards,
> Sergey
>
> --
>
> style mystyle
>
> con ct = [A = string, B = string]
>
> fun handler (x:$ct) : transaction page = return
> <xml><head/><body>{[x.A]}{[x.B]}</body></xml>
>
> fun sbm [t:::{Type}] (h : $t -> transaction page) : xml form t [] =
> <xml><div class={mystyle}><submit action={h}
> value="Send"/></div></xml>
>
> fun main {} = return <xml><head/><body>
>   <br/>
>   <form>
>   <textbox{#A}/>
>   <textbox{#B}/>
>   {sbm handler}
>   </form>
>   </body></xml>
>
>
> _______________________________________________
> Ur mailing list
> Ur at impredicative.com
> http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
>



More information about the Ur mailing list