Generic implementation syntax: the space before `<`

23 views
Skip to first unread message

Yannick Duchêne

unread,
Aug 8, 2014, 8:44:11 PM8/8/14
to ats-lan...@googlegroups.com
In:

extern fun {a: t@ype} gprint (x: a): void

implement gprint
<int> (x) = print_int (x)


If the second definition is changed into:

implement gprint <int> (x) = print_int (x) // White‑space inserted before <int>


I get the message “the keyword [=] is expected”

Seems a space is required before generic's parameters. Is this on purpose or an unintentional effect of ATS2 parser actual implementation?


Hongwei Xi

unread,
Aug 8, 2014, 8:45:45 PM8/8/14
to ats-lan...@googlegroups.com
Yes, it is intentional.





--
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/c94afd49-a97b-44ba-9be6-3954cc9e58e8%40googlegroups.com.

Brandon Barker

unread,
Aug 8, 2014, 8:45:55 PM8/8/14
to ats-lang-users
I've never seen it not that way in many cases, so I assume it is intended.
Brandon Barker
brandon...@gmail.com


On Fri, Aug 8, 2014 at 8:44 PM, 'Yannick Duchêne' via ats-lang-users
<ats-lan...@googlegroups.com> wrote:

Yannick Duchêne

unread,
Aug 8, 2014, 11:40:04 PM8/8/14
to ats-lan...@googlegroups.com
On the opposite of disallowed space, this one is to be noted too, as a case of optional space:

val+list_cons (x, xs) = xs
Although without a space, it stands for this
val+ list_cons (x, xs) = xs

I guess it's the same for all keywords ending in `+` or `-`.


gmhwxi

unread,
Aug 9, 2014, 12:28:26 AM8/9/14
to ats-lan...@googlegroups.com
Yes, the space following val+ is optional. The same
can be said about val-, case+, and case-.
Reply all
Reply to author
Forward
0 new messages