Re:Swift Algorithms
by pjmlp on Thursday October 08, 2020 @02:34AM
(#24716465)
This is how C++ compilers used to work before templates came into the picture.
For example Borland's BIDS 1.0 in Borland C++ for MS-DOS, it was based on the C pre-processor, as you would define a set of macros and then include the desired type, something like
#define LIST_T int
#include <bids/list.h>
#define LIST_T float
#include <bids/list.h>
and so on, however when BIDS 2.0 was released, there was already primitive support for the ongoing ISO discussions and it was rewritten to use templates.
To be fair, Go generics seem to be finally on their way to be adopted into the language.
For example Borland's BIDS 1.0 in Borland C++ for MS-DOS, it was based on the C pre-processor, as you would define a set of macros and then include the desired type, something like
and so on, however when BIDS 2.0 was released, there was already primitive support for the ongoing ISO discussions and it was rewritten to use templates.To be fair, Go generics seem to be finally on their way to be adopted into the language.