Skip to content

Comment on A function decorator that rewrites the bytecode to enable goto in Pythonparent

Comments

Wow I'm actually pretty blown away! I use Go on a daily basis and have never seen it used anywhere or had any clue it was in the language.

If you had asked me a few minutes ago if Go had goto I would have said "definitely not and they would never add it because it goes against the Go ethos".

The name of the language should have given it away.

Hopefully Go 2 won't have Goto

Why does it go against the Go ethos? (Asking out of curiosity. I’ve never used the language.)

I feel like they usually prioritize simplicity and readability instead of tricks, syntactic sugar, and one-liners.

For example there's no ternary operator. Instead you'll have to write out a few lines of if/else. There's no function overloading or operator overloading, no built in min/max, and currently no generics (though they're being added).

They definitely try to keep the number of keywords down to a minimum compared to languages like Swift where you could write the same business logic in fewer lines using stuff like try, guard, !, and ?.

An if-statement is essentially sugar for conditional jump which is sugar for compare then jump. Goto is a jump. It’s all sugar.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.