Symintr: required or optional?

23 views
Skip to first unread message

Yannick Duchêne

unread,
Aug 8, 2014, 11:41:15 PM8/8/14
to ats-lan...@googlegroups.com
Hi people,

Another basic question.

Looking at Overloading Functions in ATS (bluishcoder.co.nz), I came to this sample:

symintr my_print

fun my_print_integer
(a: int)    = (print_int (a); print ("\n"))
fun my_print_double  
(a: double) = (print_double (a); print ("\n"))
fun my_print_string  
(a: string) = (print_string (a); print ("\n"))

overload my_print
with my_print_integer
overload my_print
with my_print_double
overload my_print
with my_print_string


(the original uses a `printf` which seems not there any‑more in ATS2)

If I remove the `symintr` declaration, it's still accepted. Looks like `overload` alone is enough?

Side note: I like explicit overloading declaration of ATS2 (in some context, I like when things are explicit).

Hongwei Xi

unread,
Aug 9, 2014, 12:47:17 AM8/9/14
to ats-lan...@googlegroups.com
Right now, if a symbol is available, then it is used, Otherwise, a new one is introduced
implicitly.




--
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 http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/e4dbd377-f0c2-4a48-9c19-bbb64527ce8c%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages