7 ms·
Go 2 Considered Harmful: https://homepages.cwi.nl/~storm/teaching/reader/Dijkstra68.pdf https://homepages.cwi.nl/~storm/teaching/reader/Dijkstra68.p...
by gnarbarian 8y ago
Go 2 Considered Harmful:
https://homepages.cwi.nl/~storm/teaching/reader/Dijkstra68.pdf https://homepages.cwi.nl/~storm/teaching/reader/Dijkstra68.p...
- sdegutis 8y agoYou got me. Genuinely thought it was gonna be a critique.
- dao- 8y agoSo what is it? I'm on my phone and don't feel like downloadig a random PDF just for curiosity...
- williamdclt 8y agoDijkstra's critique of the `goto` statement
- barrkel 8y agoIt's a pun. "Go 2" -> "Go To". Dijkstra coined "considered harmful" with the paper (letter) on "Go To statement considered harmful".
- Stratoscope 8y agoIt was actually Niklaus Wirth (designer of Pascal and other languages) who coined "considered harmful": > In 1968 the Communications of the ACM published a text of mine under the title "The goto statement considered harmful, which in later years would be most frequently referenced, regrettably, however, often by authors who had seen no more of it than its title, which became a cornerstone of my fame by becoming a templace: we would see all sorts of articles under the title 'X considered harmful' for almost any X, including one titled "Dijkstra considered harmful." > But what had happened? I had submitted a paper under the title "A case against the goto statement, which in order to speed up its publication, the editor had changed into a 'Letter to the Editor', and in the process he had given it a new title of his own invention! The editor was Niklaus Wirth". https://www.theregister.co.uk/2002/08/08/edsger_dijkstra_rip/ https://www.theregister.co.uk/2002/08/08/edsger_dijkstra_rip... https://en.wikipedia.org/wiki/Considered_harmful https://en.wikipedia.org/wiki/Considered_harmful
- vram22 8y agoI seem to remember seeing a few articles about "'$X considered harmful' considered harmful'. Also: Why Functional Programming Matters and Why Why Functional Programming Matters Matters Edit: Just saw the sibling comment by Stratoscope: "we would see all sorts of articles under the title 'X considered harmful' for almost any X, including one titled "Dijkstra considered harmful." :)
- Stratoscope 8y agoAnd this classic by Scott Meyers of Effective C++ fame: "Considered Harmful" Essays Considered Harmful https://meyerweb.com/eric/comment/chech.html https://meyerweb.com/eric/comment/chech.html
- vram22 8y agoThanks, will check that out. I really liked the Effective C++ book by Scott. There's a good video talk by him titled something like "The Last Thing D Needs".
- naibafo 8y ago> Edgar Dijkstra: Go To Statement Considered Harmful
- agumonkey 8y agoWell played sir
- Zenst 8y agoWhen I started work in the early 80's as a COBOL analyst programmer, I encountered ideology vs reality of GOTO. When I learned COBOL, I was taught Jackson Structured Programming. No use of GOTO at all, even exception handling. Fast forward in my first week into work and having done a nice JSP program for the task at hand a senior came over with my code and had a chat. Then took me to the system developers who did all the dirty low level assembler code (for sorts and other area's in which speedup was huge over COBOL). Was shown how my approach was far more wasteful of CPU resources and why others would not be able to maintain such code as all the rest used GOTO's. I will admit, it was nicely explained and this is in a time in which mainframes offered the only computer solutions for business of this scale and not cheap. I will say GOTO's work well for exception handerling, but still doable without. But for speed, though less of a factor today, it still translates as faster code at the low level of CPU runs. But then, things move on and you will always have that wave of what students are taught being cutting edge compared to what is actualy in use in work. A friction many would have encountered in one form or another, even today. Be it style, design or language/tools choice. What is the best today, may well be outdated tomorrow, but you have to maintain that legacy investment and it is often too costly/risky to rewrite that legacy for something that itself could be legacy the next day. So as for harmful, well they can spagetti up code if used badly, yet that comes to many approaches and if they are that bad, why do CPU's still have JUMP instructions you could counter-argue. Oh and well played on the humour.
- fwip 8y agoAre there normal coding patterns that are much faster with explicit gotos? Modern compilers seem to do a pretty good job of converting normal (goto-less) code into efficient binaries. E.g, the simple switch statement has several possible machine-code implementations that compilers will switch (heh) between, depending on the characteristics of the cases.
- beetwenty 8y agoIn bytecode interpreter VMs, one often encounters the "computed goto" [1] pattern in use to dispatch opcodes. This is one that tends to be a little faster than a switch statement, enough to matter in the dispatch inner loop. Of course, if you are going to JIT compile the bytecode, that'll usually be a lot faster. But at that point you're changing one form of low-level wizardry for another. [1] https://eli.thegreenplace.net/2012/07/12/computed-goto-for-efficient-dispatch-tables https://eli.thegreenplace.net/2012/07/12/computed-goto-for-e...
- vram22 8y agoI wonder how many people got the joke without reading the link. Good one, boss.
- slap_shot 8y agoI appreciate a good joke, but is this really necessary on a thread like this? Here's the equivalent Reddit thread; better suited for this sort of comment: https://www.reddit.com/r/golang/comments/a1j3h6/go_2_here_we_come/ https://www.reddit.com/r/golang/comments/a1j3h6/go_2_here_we...
- tyrust 8y agoSmaller subreddits (like the one you linked) are typically against shitposting as well.
- deleted 8y ago[deleted]
- colonelpopcorn 8y agoI came here just to say that. Glad to see I wasn't the only one.
- hu3 8y agothis kind of comment says a lot about current state of HN this is the new Reddit
- burke 8y agoGod forbid that one of 208 comments is a (rather funny) joke. I don't get why some people here are so against humour. I appreciate the high standards for jokes and expectation of high signal:noise, but this was clever and topical.
- codegeek 8y agoI always appreciate a good joke but unfortunately this has become the top comment as of now and is not adding to the real discussion around Go 2. This is a typical case of when I use my downvote power. Great joke but we should keep HN noise free.
- esrauch 8y agoIs it really so harmful to have it at the top of the comment thread? I think HN can be focused mainly on serious discourse without being completely humorless.
- codegeek 8y agoI think about it all the time. But imagine leaving the page and coming back a few hours later. Now you have to sort through tons of unnecessary comments (even if funny and humorous) while you look for the quality stuff. Quality requires sacrifice and I am willing to sacrifice the humor part for quality unless you throw in a bit of humor with quality content.
- Stratoscope 8y agoA great way to solve this is to use the [-] button to collapse any comment threads that you're not interested in following, like this one. HN remembers which threads you've collapsed, so you won't see them when you come back to the page.