Though I see what you might be getting at. There is a difference between
implementing a template 'forall' vs for a particular type
On Tuesday, June 25, 2019 at 6:27:40 PM UTC-4, Richard wrote:
>
>
>
> 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).
>>
>
> Just out of curiosity, did you build Temptory from the releases or from
> scratch?
>
>
>>
>> It seems that call-by-reference functions in record definitions cause
>> issues with template dispatch.
>>
>> The following will fail to compile ( no match for `do_something` ) --
>> changing the signature of `foo.f` to `(int) -> void` will compile
>> successfully.
>>
>>
> Edited below:
> The main difference is annotating the argument 'a' and removing the
> template <foo> and replacing with impltmp{a} instead.
>
>
>>
>> #include "share/HATS/temptory_staload_bucs320.hats"
>>
>> typedef foo = @{
>> f = (&int) -> void
>> }
>>
>> extern
>> fun {a:vtflt} do_something( a:foo ) : void
>>
>> impltmp{a}
>> do_something( 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.
>>
>
--
You received this message because you are subscribed to the Google Groups
"ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/1fd59896-794d-4756-8faf-2ee28121a39f%40googlegroups.com.