4 ms·
Steve Wozniak is not boring
- rmason 12y agoInspirational for sure but never boring.
- LukeB_UK 12y agoA good example of companies and open source projects having a little humour and showing that they're human too.
- yRetsyM 12y agoIs this a reference to some earlier comment? Or just a general shout out to a hero of the programmer?
- kghose 12y agoNo, sometimes the generator will come up with boring_wozniac, and they just catch that case.
- hcarvalhoalves 12y agoRead the source - it's a random name generator that pairs adjectives + names.
- hcarvalhoalves 12y agoNice touch.
- gnuvince 12y agoCan we say something about using goto?
- pervycreeper 12y agoor a loop that is not guaranteed to end?
- klodolph 12y agoPRNGs don't work that way. They have periods over which all possible output values are produced, close to an equal number of times. Even when producing tuples, we know that this won't loop forever.
- pervycreeper 12y agoYou know that, because you already know how "rand" is implemented
- Amezarak 12y agoWhy? To be sure they should be used sparingly, but it looks it makes enough sense in this particular case and isn't single-handedly going to cause any spaghetti-code problems. In this particular case I think a goto fits the bill.
- drdeadringer 12y agoIf you use it responsibly, I don't see much problem.
- rgawdzik 12y agoAll tools can be misused. Goto has a dark past, but it can still be used responsibly. It's almost like generalizing a concept like OOP to be bad because horrible code can be made with it.
- adamgravitis 12y agoAt least in this situation, you can see the entire affected control flow within four lines. goto generally becomes a problem when suddenly everything is short-circuiting everywhere and you can't see where control's getting passed off to.
- mholt 12y agoSure. This is a fair use case. Kind of makes more sense than a full while loop, especially since the case is only likely to occur at most once per call to GetRandomName().
- hmrmaxwell 12y agoIt seems that mild goto usage is not uncommon in at least some major golang projects: https://github.com/dotcloud/docker/search?q=goto&ref=cmdform https://github.com/dotcloud/docker/search?q=goto&ref=cmdform https://github.com/hashicorp/serf/search?q=goto&ref=cmdform https://github.com/hashicorp/serf/search?q=goto&ref=cmdform https://github.com/skynetservices/skydns/search?q=goto&ref=cmdform https://github.com/skynetservices/skydns/search?q=goto&ref=c... https://github.com/calmh/syncthing/search?q=goto&ref=cmdform https://github.com/calmh/syncthing/search?q=goto&ref=cmdform https://github.com/juju/juju/search?q=goto&ref=cmdform https://github.com/juju/juju/search?q=goto&ref=cmdform EDIT: formatting
- kyrra 12y agoGo is fairly strict in the use of goto: http://golang.org/ref/spec#Goto_statements http://golang.org/ref/spec#Goto_statements They have their use cases, and this code seems like a fine use of it. Goto is taught as one of those things you should never use but it still has a purpose. If you look at any C code goto still used. You just have to make sure not to overuse it.
- trevmckendrick 12y agoFor the nontechnical out there: This is a random name generator that pairs adjectives with names (e.g. "angry_einstein"). In the unlikely chance the generator returns the pair "boring_wozniak", it discards it and generates another name.