<div dir="ltr">Hi<div><br></div><div>I'm trying to define a structure within let block but it fails. Having the structure outside works perfectly fine.</div><div><br></div><div>sample.ur</div><div><pre style="background-color:rgb(43,43,43);color:rgb(169,183,198);font-family:Menlo;font-size:9pt">fun main()=<br>let<br><br> fun debugMe a =<br> alert a<br><br><br> structure AB = Mymaths.Make(struct<br> val callback = debugMe<br> end)<br><br> fun callMe () =<br> x <- AB.simple "test";<br> debug x<br><br>in<br> return <xml><br> <body><br> <h1> Sample </h1><br> <button value="Click Me" onclick={fn _ => callMe()}></button><br> </body><br> </xml><br>end<br><br></pre><div><br></div><div>Above code throws compile error, where as the following code compiles & runs fine :</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><br> structure AB = Mymaths.Make(struct<br> val callback = debugMe<br> end)<br><br>fun main()=<br>let<br> fun callMe () =<br> x <- AB.simple "test";<br> debug x<br><br>in<br> return <xml><br> <body><br> <h1> Sample </h1><br> <button value="Click Me" onclick={fn _ => callMe()}></button><br> </body><br> </xml><br>end<br><br></pre></div><div><br></div><div>Any idea what's going wrong ? Can't a structure be created within let ? If no, then is there an alternative ?</div><div><br></div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div dir="ltr"><div dir="ltr">Regards<div>Nitin Surana</div><div>MS Computer Science</div><div><br></div><div><br></div></div></div></div></div>
</div></div>