www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - I ported significant portions of D ranges and algorithms to Go

reply w0rp <devw0rp gmail.com> writes:
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!
Jun 08 2022
next sibling parent Tejas <notrealemail gmail.com> writes:
On Wednesday, 8 June 2022 at 16:27:01 UTC, w0rp wrote:
 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!
Posts like these belong in the [Announce](https://forum.dlang.org/group/announce) part of the forums, I believe. Cool project though, haven't ever used Go, so maybe I'll take a look at it :)
Jun 08 2022
prev sibling parent user1234 <user1234 12.de> writes:
On Wednesday, 8 June 2022 at 16:27:01 UTC, w0rp wrote:
 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


 Enjoy!
Nice, excepted for the tuples.
Jun 08 2022