Live data from Hacker News

Show HN: Fo: An experimental language which adds generics on top of Go

github.com

11–20 of 125 posts

Re: Show HN: Fo: An experimental language which adds generics on top of Go

#11

Author here. I've been working on Fo part time for 4 months. Feel free to ask me anything.

What does the implementation look like under the hood? What are the limitations of your approach (i.e. generic interfaces) and are they fundamental or just on the todo list?

Here are a couple diffs that leave out the copied code:

https://github.com/albrow/fo/compare/faf3c9f96a8ecd9d17ca968...

https://github.com/albrow/fo/compare/f76c531f839e5e76e5f6b7f...

Re: Show HN: Fo: An experimental language which adds generics on top of Go

#12

Author here. I've been working on Fo part time for 4 months. Feel free to ask me anything.

What does the implementation look like under the hood? What are the limitations of your approach (i.e. generic interfaces) and are they fundamental or just on the todo list?

It's very likely monomorphizing the types, i.e. creating a unique type for each generic invocation.

Re: Show HN: Fo: An experimental language which adds generics on top of Go

#16

Interesting, now all you need to do is add exceptions :)

Golang already has an exceptions-equivalent construct in the shape of panic() and recover(): https://blog.golang.org/defer-panic-and-recover

You’re free to write exception-full code using those constructs, although the community tends to use error return values for the most part.

Re: Show HN: Fo: An experimental language which adds generics on top of Go

#17
This is suuuper cool. I've thought of doing something similar for a while, but I tried approaching it from the "generate Go" angle. I also found the Go syntax too tedious to write a parser for (because I've never written a parser before, nor any kind of compiler, so the learning curve was too steep). So I was just going to try to build a simple, expression-based language that compiled to (and interoped with) Go. Unfortunately, I ran out of steam because the learning curve was so steep.
Post reply on HN