Re: [ats-lang-users] template functions vs polymorpdic functions
Unleashing the potentials of types and templates
Status: Beta
Brought to you by:
ats-hwxi
From: Matthias B. <mat...@gm...> - 2010-04-05 11:29:40
|
> This is a function template. Just like in C++, a template is not > compiled until it is applied. If you call f(1), then *essentially*, > the following function is generated > > fun f_int (x: int): x = x That should probably be fun f_int(x: int): int = x > and the call becomes f_int(1). If you call f(1.0), then the following > function is generated: > > fun f_double (x: int): x = x And this should probably be fun f_double(x: double): double = x |