News for hackers. Stuff that matters.
Re:Swift Algorithms by bee_rider on Wednesday October 07, 2020 @10:55PM (#24715189)
Googling about this (I assumed the actual 'solution' would be a to use C-style awful macro kludges) eventually lead me to:

https://blog.golang.org/generate

Now I'm wondering if you joke was not actually a joke.

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.

Re:Swift Algorithms by xmprt on Thursday October 08, 2020 @02:37AM (#24716473)
We have a lot of codegen in our codebase right now and I can't wait for the day that generics are finally added.
Re:Swift Algorithms by pjmlp on Thursday October 08, 2020 @08:08AM (#24718341)
As heavy critic, but also fan, I have been following up on it, and the last update on the document is from September, so I am positive they might make it, it just appears the proper implementation still has some engineering challenges.

https://go.googlesource.com/proposal/+/refs/heads/master/des...

Re:Swift Algorithms by Joker_vD on Thursday October 08, 2020 @09:05AM (#24718738)
Well, and there is also kinda sorta support foir generics on top of it:

https://github.com/vasilevp/aboriginal

There is no engineering challenge that can't be overcome by ingenious thought!