I don't know how to do it,

This gets into the domain of meta-programming.

In general, it is very difficult to do meta-programming in a typeful
manner.  Often one tries to write code to generate code that may
contain type-error and then apply typechecking to the generated code.

On Friday, October 20, 2017 at 5:45:45 PM UTC-4, Steinway Wu wrote:
>
> Hi, 
>
> We now have dynamic templates, parameterized by static terms. Is it 
> possible to have some simple form of static templates like the followings? 
> Or is there any other way to make static functions ad-hoc polymorphic? 
>
> datasort typelist =
> | tnil of ()
> | tcons of (t@ype, typelist)
>
> #define :: tcons
>
> datatype OneConstructor     = One     of (int, int, string)
> datatype AnotherConstructor = Another of (int, int, bool)
>
> template stacst Code<type>: typelist
>
> implement Code<OneConstructor>     = int :: int :: string :: tnil
> implement Code<AnotherConstructor> = int :: int :: bool :: tnil
>
>
>
>
>
>
>

-- 
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/1239a064-35b5-4cab-a083-5975a6f62153%40googlegroups.com.

Reply via email to