Hi

I'm trying to define a structure within let block but it fails. Having the
structure outside works perfectly fine.

sample.ur

fun main()=
let

    fun debugMe a =
            alert a


    structure AB = Mymaths.Make(struct
                                   val callback = debugMe
                               end)

    fun callMe () =
        x <- AB.simple "test";
        debug x

in
    return <xml>
        <body>
            <h1> Sample </h1>
            <button value="Click Me" onclick={fn _ => callMe()}></button>
        </body>
        </xml>
end


Above code throws compile error, where as the following code compiles &
runs fine :

fun debugMe a =
            alert a

    structure AB = Mymaths.Make(struct
                                   val callback = debugMe
                               end)

fun main()=
let
    fun callMe () =
        x <- AB.simple "test";
        debug x

in
    return <xml>
        <body>
            <h1> Sample </h1>
            <button value="Click Me" onclick={fn _ => callMe()}></button>
        </body>
        </xml>
end


Any idea what's going wrong ? Can't a structure be created within let ? If
no, then is there an alternative ?


-- 
Regards
Nitin Surana
MS Computer Science
_______________________________________________
Ur mailing list
Ur@impredicative.com
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur

Reply via email to