<div dir="ltr">Hi Adam<div><br></div><div>I tried to create a sample from what I understand about your suggestion, but of course I got it wrong. </div><div>Following is the code (which doesn't compile), which would demonstrate what I'm trying to do (look for 4 forward slashes ////)</div><div><br></div><div><pre style="background-color:rgb(43,43,43);color:rgb(169,183,198);font-family:Menlo;font-size:9pt">fun debugMe a =<br>        alert a;<br>        ////can't read from source n here, because it's defined within main(), below doesn't compile<br>        fnn <- get n;<br>        fnn()<br><br>structure AB = Mymaths.Make(struct<br>                               val callback = debugMe<br>                           end)<br><br>fun main()=<br>  n <- source Nil;<br>  lss <- source Nil;<br>let<br>    fun callMe () =<br>        x <- AB.simple "test";<br>        debug x<br><br>    fun anotherCallback()<br>        //iterate over source lss and do something<br><br>in<br>    //Some code to change the callback debugMe to anotherCallback() but what ?!<br>    set n anotherCallback   ////this doesn't work<br>    return <xml><br>        <body><br>            <h1> Sample </h1><br>            <button value="Click Me" onclick={fn _ => callMe()}></button><br>        </body><br>        </xml><br>end</pre></div><div>Thanks</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 10, 2017 at 1:45 PM, Adam Chlipala <span dir="ltr"><<a href="mailto:adamc@csail.mit.edu" target="_blank">adamc@csail.mit.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <p>You can register a callback that, when called, reads another
      callback out of a [source] and calls it.  Is that sufficient?<br>
    </p><span class="">
    <div class="m_3884067285525225605moz-cite-prefix">On 11/10/2017 04:19 PM, Nitin Surana
      wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">Hi Adam
        <div><br>
        </div>
        <div>Thanks for responding. Is there any alternative to change
          the callback ? I want to trigger a urweb function defined
          within `let` block upon a javascript event. </div>
        <div>Since, the function is within `let` block (because it needs
          access to certain variables within the parent function), I'm
          unable to use execF(...) from javascript.</div>
        <div><br>
        </div>
        <div>Also, is `ref` not supported in urweb ?</div>
        <div><br>
        </div>
        <div>Thanks</div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Fri, Nov 10, 2017 at 4:48 AM, Adam
          Chlipala <span dir="ltr"><<a href="mailto:adamc@csail.mit.edu" target="_blank">adamc@csail.mit.edu</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div text="#000000" bgcolor="#FFFFFF"><span>
                <div class="m_3884067285525225605m_5243511948070250283moz-cite-prefix">On
                  11/09/2017 10:42 PM, Harshita Kasera wrote:<br>
                </div>
                <blockquote type="cite">
                  <div dir="ltr"><span style="font-size:12.8px"></span>
                    <div style="font-size:12.8px">
                      <div style="font-size:12.8px">What I ultimately
                        want to achieve is to be able to change the
                        callback function <i>debugMe</i> at a later
                        point of time. Is it possible to set or update
                        values within a structure at a later point of
                        time?</div>
                    </div>
                  </div>
                </blockquote>
                <br>
              </span> No, module (structure) fields can't be modified at
              runtime in Ur/Web or ML.  Therefore, the module system is
              not the right tool for runtime rewriting of callbacks.<br>
            </div>
          </blockquote>
        </div>
      </div>
    </blockquote>
    <br>
  </span></div>

<br>______________________________<wbr>_________________<br>
Ur mailing list<br>
<a href="mailto:Ur@impredicative.com">Ur@impredicative.com</a><br>
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.impredicative.com_cgi-2Dbin_mailman_listinfo_ur&d=DwIGaQ&c=clK7kQUTWtAVEOVIgvi0NU5BOUHhpN0H8p7CSfnc_gI&r=fRXDP9LYNqdFgci7lxN2fw&m=4BPlw-ffwmldYJ_nUfPoCMcCEtXDUqFj73lIc-B35lQ&s=SdXCyX5EL_W3lxWpCwUlkH65djIEQvhG4MnsKPjypKE&e=" rel="noreferrer" target="_blank">https://urldefense.proofpoint.<wbr>com/v2/url?u=http-3A__www.<wbr>impredicative.com_cgi-2Dbin_<wbr>mailman_listinfo_ur&d=DwIGaQ&<wbr>c=<wbr>clK7kQUTWtAVEOVIgvi0NU5BOUHhpN<wbr>0H8p7CSfnc_gI&r=<wbr>fRXDP9LYNqdFgci7lxN2fw&m=<wbr>4BPlw-ffwmldYJ_<wbr>nUfPoCMcCEtXDUqFj73lIc-B35lQ&<wbr>s=SdXCyX5EL_<wbr>W3lxWpCwUlkH65djIEQvhG4MnsKPjy<wbr>pKE&e=</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr">Regards<div>Nitin Surana</div><div>MS Computer Science</div><div>323-690-6529</div><div><br></div></div></div></div></div></div>
</div>