I think that ATS can already support this:

#include
"share/atspre_staload.hats"

fun ???(x: int, y: int): int = x + y

val x = op???(1, 2)

val y = 1 \op??? 2

val () = println! ("x = ", x)
val () = println! ("y = ", y)

implement main0() = ()


On Wed, Apr 11, 2018 at 3:55 PM, Steinway Wu <steinway...@gmail.com> wrote:

> Did anyone mention operators definition/overloading? I think currently in
> ATS2, one can only overload a symbol with a function. But I actually prefer
> how OCaml and Haskell handles operators: they are just functions whose
> names happen to be symbols instead of alphabets. One use parenthesis around
> the symbols to define it, and use the symbol without parenthesis to invoke
> it. I hope ATS3 can have better support for first-class user-defined
> operators without relying on overloading.
>
> // something like this for any infix operators would be nice
> fun (?op) (arg1:type1, arg2:type2): type3 = ...
>
> val x = y ?op z     // use it as infix op by default
> val x = (?op)(y, z) // temporarily use it as prefix op
>
>
>
> On Friday, February 9, 2018 at 1:15:22 PM UTC-5, gmhwxi wrote:
>>
>> For the moment, I just want to open a thread for ATS3.
>>
>> I decided to pick ATS/Xanadu for the full project name. I like the name
>> Xanadu
>> because it is poetic and brings a feel of exoticness.
>>
>> ATS3 is supposed to be compiled to ATS2. At least at the beginning. I
>> will try to
>> write more about what I have in mind regarding ATS3.
>>
>> I know that a lot of people have been complaining about the syntax of
>> ATS2. So
>> we can start the effort of designing some "nice" syntax for ATS3. Please
>> feel free
>> to post here if you would like share your opinions and ideas.
>>
>> I will be happy to take the lead but we definitely need to have some form
>> of community
>> effort on this project given its size and scope.
>>
>> Cheers!
>>
>> --Hongwei
>>
>> PS: I felt rushed every time up to now when implementing ATS. This time I
>> am hoping
>> to have the luxury of thinking about implementation a bit before actually
>> doing it :)
>>
>> --
> 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-users+unsubscr...@googlegroups.com.
> To post to this group, send email to ats-lang-users@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/07fc31bd-21c0-4d84-bed0-283bd9b40fb8%
> 40googlegroups.com
> <https://groups.google.com/d/msgid/ats-lang-users/07fc31bd-21c0-4d84-bed0-283bd9b40fb8%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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-users+unsubscr...@googlegroups.com.
To post to this group, send email to ats-lang-users@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/CAPPSPLo9jA84aj_ECETJf821Xf-EC0w1Y%3DBP2zXfiWer8V27%3Dw%40mail.gmail.com.

Reply via email to