|
|
|
|
|
by staticint
3850 days ago
|
|
> It doesn't have generics, at all. The provided tooling provides templating, which isn't dissimilar to where many other languages stop in their generics journey. The interface does leave a lot to be desired, granted. func max(a, b T) T {
if a > b {
return a
}
return b
}
$ gofmt -r 'T -> int' -w max.go
|
|
What distinguishes templates from macros is that templates deeply interact with and are instiantiated at the time of typechecking. Macros, on the other hand, are expanded at parse time (or, in more sophisticated implementations, at name resolution time).