I suppose there has been a fair bit of talk about syntax already. I had
been thinking a whitespace-significant label-block structure (a-la Nim)
might suit the language well, and some recent code sample inspired me to
demonstrate.
Original:
datasort tlist = tnil
| tcons of (t0ype, tlist)
extern fun {t:tlist} foo(): void
extern fun {a:t0ype} foo$fopr(): void
implement foo<tnil>() = ()
implement(a,ts) foo<tcons(a,ts)>() = {
val () = foo$fopr<a>()
val () = foo<ts>()
val () = ignoret (1)
}
implement main0 () = let
implement foo$fopr<int>() = println!("int")
implement foo$fopr<string>() = println!("string")
implement foo$fopr<bool>() = println!("bool")
val () = println!("test 1: should print int, string")
val () = foo<tcons(int, tcons(string, tnil))>()
val () = println!("test 2: should print bool, int")
val () = foo<tcons(bool, tcons(int, tnil))>()
in
Example:
datasort tlist = tnil
| tcons of (type, tlist)
extern
fun {t:tlist} foo(): void
fun {a:type} foo$fopr(): void
impl
foo<tnil>() = ()
(a,ts) foo<tcons(a,ts)>() = {
val
() = foo$fopr<a>()
() = foo<ts>()
}
main0 () =
let
impl
foo$fopr<int>() = println!("int")
foo$fopr<string>() = println!("string")
foo$fopr<bool>() = println!("bool")
val
() = println!("test 1: should print int, string")
() = foo<tcons(int, tcons(string, tnil))>()
() = println!("test 2: should print bool, int")
() = foo<tcons(bool, tcons(int, tnil))>()
in ()
I guess the good thing here is that it's 99% ATS2. Of course, there are
likely plenty of issues, including whitespace-significance (I was hesitant
to post something this concrete).
--
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/7a7e5e9d-5267-4499-9ebf-9ea51aeb2212%40googlegroups.com.