Hacker News new | past | comments | ask | show | jobs | submit login

I'd say it's more similar to Javascript. In fact all of the examples are valid JS if you replace `fn` with `function`. (Although JS doesn't have implicit returns.)

At a guess, the author chose the syntax because it's familiar and easy to parse. Go's syntax is... eccentric where it differs from typical C-style languages.




Author here. Yes, that's exactly right. I wanted to show how to write a parser/interpreter for something that you encounter every day. JavaScript-like syntax, with curly braces and `if`/`else` is just that.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: