On Tuesday, June 25, 2019 at 9:47:50 AM UTC-4, M88 wrote:
> I noticed this a while ago in ATS2 (just verified in Temptory).
>
>
>
> It seems that call-by-reference functions in record definitions cause issues with template dispatch.
>
From what I can tell after some testing, a type defined as a function with call-by-reference seems to cause the same issue (even outside records).
>
> The following will fail to compile ( no match for `do_something` ) -- changing the signature of `foo.f` to `(int) -> void` will compile successfully.
>
>
>
>
>
>
> #include "share/HATS/temptory_staload_bucs320.hats"
>
> typedef foo = @{
> f = (&int) -> void
> }
>
> extern
> fun {a:vtflt} do_something( a ) : void
>
> impltmp
> do_something<foo>( x ) =
> let
> var z : int = 0
> in x.f(z)
> end
>
> implfun main0()
> = println!("Hello [test0]")
> where {
> var ff : foo = (@{
> f = lam(x) => println!(x)
> }): foo
>
> val () = do_something<foo>(ff)
> }
>
>
>
>
> I've been using abstract types / casting as a work-around.
Could you share how you use abstract type / casting in this example to get it to work?