I ported significant portions of D ranges and algorithms to Go

w0rp devw0rp at gmail.com
Wed Jun 8 16:27:01 UTC 2022


Hello there! I mentioned this previously to Andrei in an email as 
something I was experimenting with for fun. I have ported 
significant portions of D ranges and algorithms to Go, as Go 1.18 
added pretty decent generic typing. Here it is: 
https://github.com/w0rp/ranges

I didn't implement every function there is, and I limited my 
initial push of what to implement to InputRange and ForwardRange 
alone. The README documents the limitations in Go, and one thing 
I consider an advantage. Generally what you can do in Go will 
never be as powerful as D's complete template meta-programming 
functionality, but it is interesting to see just how much can be 
represented in Go.

Maybe there is something or other in here that someone can learn 
something from. I just did it entirely for a laugh and to play 
around with how generics work in Go in a serious way.

Enjoy!


More information about the Digitalmars-d mailing list