|
|
|
|
|
by pcwalton
3850 days ago
|
|
No, that's just a very basic implementation of macros. Even C can implement max that way. 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). |
|
Although you do have me curious how you'd implement max in C in this type-safe way using standard tooling:
...obviously wouldn't fit the bill since it doesn't enforce types like to Go version does.