Template and Overloading

Hi,

Is it possible to do overloadings like below?

fun {a:t@ype} gcomapre_val_val (a, a): int

symintr compare
overload compare with gcompare_val_val<int> 
overload compare with gcompare_val_val<uint> 

I’m asking this since this. Say, we have a dummy mycompare

fun {a:t@ype} mycompare (a, a): int
implement {a} mycompare (x, y) = gcompare_val_val<a> (x, y)

symintr comapre
overload compare with mycompare 

Then ATS seems to have a hard time figuring out template variables when
instantiating.
Whenever we use compare, we have to specify fully what type it is. I’m
thinking if

overload compare with mycompare<int>
overload compare with mycompare<float>

could help in any way?

I saw
this, Overloading Functions in ATS,
which describes the same thing I would like to do. But those examples no
longer work.On Friday, August 12, 2016 at 12:13:12 PM UTC-4, Steinway Wu wrote:

Hi,

Is it possible to do overloadings like below?

fun {a:t@ype} gcomapre_val_val (a, a): int

symintr compare
overload compare with gcompare_val_val<int> 
overload compare with gcompare_val_val<uint> 

I’m asking this since this. Say, we have a dummy mycompare

fun {a:t@ype} mycompare (a, a): int
implement {a} mycompare (x, y) = gcompare_val_val<a> (x, y)

symintr comapre
overload compare with mycompare 

Then ATS seems to have a hard time figuring out template variables when
instantiating.
Whenever we use compare, we have to specify fully what type it is. I’m
thinking if

overload compare with mycompare<int>
overload compare with mycompare<float>

could help in any way?

Try:
fun{a:t@ype}mycompare(INV(a), a): int------ Original message------From: Steinway WuDate: Fri, Aug 12, 2016 12:13 PMTo: ats-lang-users;Subject:Template and Overloading
Hi,
Is it possible to do overloadings like below?

symintr compareoverload compare with gcompare_val_val<int> overload compare with gcompare_val_val<uint> ```
I'm asking this since this. Say, we have a dummy `mycompare`
```fun {a:t@ype} mycompare (a, a): intimplement {a} mycompare (x, y) = gcompare_val_val<a> (x, y)
symintr comapreoverload compare with mycompare ```
Then ATS seems to have a hard time figuring out template variables when instantiating. Whenever we use `compare`, we have to specify fully what type it is. I'm thinking if
```overload compare with mycompare<int>overload compare with mycompare<float>``` 
could help in any way?-- 
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 ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
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/246342e5-b458-4e30-ad6b-adad7615e893%40googlegroups.com.

Black magic… Why does it work?On Friday, August 12, 2016 at 6:09:40 PM UTC-4, gmhwxi wrote:

Try:

fun{a:t@ype}

mycompare(INV(a), a): int

Sent from my T-Mobile 4G LTE device

------ Original message------

*From: *Steinway Wu

*Date: *Fri, Aug 12, 2016 12:13 PM

*To: *ats-lang-users;

*Subject:*Template and Overloading

Hi,

Is it possible to do overloadings like below?

fun {a:t@ype} gcomapre_val_val (a, a): int

symintr compare
overload compare with gcompare_val_val<int> 
overload compare with gcompare_val_val<uint> 

I’m asking this since this. Say, we have a dummy mycompare

fun {a:t@ype} mycompare (a, a): int
implement {a} mycompare (x, y) = gcompare_val_val<a> (x, y)

symintr comapre
overload compare with mycompare 

Then ATS seems to have a hard time figuring out template variables when
instantiating.
Whenever we use compare, we have to specify fully what type it is. I’m
thinking if

overload compare with mycompare<int>
overload compare with mycompare<float>

could help in any way?

Please visit:

Redirecting to Google Groups Monday, August 15, 2016 at 10:59:06 AM UTC-4, Steinway Wu wrote:

Black magic… Why does it work?

On Friday, August 12, 2016 at 6:09:40 PM UTC-4, gmhwxi wrote:

Try:

fun{a:t@ype}

mycompare(INV(a), a): int

Sent from my T-Mobile 4G LTE device

------ Original message------

*From: *Steinway Wu

*Date: *Fri, Aug 12, 2016 12:13 PM

*To: *ats-lang-users;

*Subject:*Template and Overloading

Hi,

Is it possible to do overloadings like below?

fun {a:t@ype} gcomapre_val_val (a, a): int

symintr compare
overload compare with gcompare_val_val<int> 
overload compare with gcompare_val_val<uint> 

I’m asking this since this. Say, we have a dummy mycompare

fun {a:t@ype} mycompare (a, a): int
implement {a} mycompare (x, y) = gcompare_val_val<a> (x, y)

symintr comapre
overload compare with mycompare 

Then ATS seems to have a hard time figuring out template variables when
instantiating.
Whenever we use compare, we have to specify fully what type it is. I’m
thinking if

overload compare with mycompare<int>
overload compare with mycompare<float>

could help in any way?