thinking about a programming language feature i really want and realizing that its just goto
-
Show this thread
-
what if there was a way to skip to a totally different error handling path, why hasn't anyone done this
1 reply 0 retweets 0 likesShow this thread -
Replying to @chriseberly
When your logics a dump And you just need to jump That’s a goto!
1 reply 0 retweets 1 like -
-
-
Replying to @stephentyrone
probably at some point, but it's probably worth a re-read since I can't remember. More recently
@cmuratori made the (imho) very good point that goto's are just jmpXX instructions and not some alien thing introduced to harm people :)2 replies 0 retweets 3 likes -
Replying to @chriseberly @cmuratori
The basic problem is that assembly does not have scope, but most languages with goto do, which makes it not “just” a jmp in any meaningful way. That’s a dangerously deceptive argument IMO (and I say that as a long-time assembly programmer).
1 reply 0 retweets 0 likes -
Replying to @stephentyrone @cmuratori
yes i'm heavily paraphrasing casey here, his point was more that programs run by advancing a program counter
2 replies 0 retweets 0 likes -
Replying to @chriseberly @stephentyrone
The actual point I made was that people need to understand how conditionals and loops translate into machine code (the reverse of what it sounds like you are talking about here). This is especially important given that masks and cmovs are increasingly important.
2 replies 0 retweets 4 likes -
I recommend everyone write a program at least once that does every construct with gotos only (if, else, while, do, do-while, switch). I think it's critical that people understand what the CPU actually is doing here, because most people today do not.
1 reply 0 retweets 4 likes
I don't, however, find gotos particularly useful in practice once you have gained the knowledge of how CPU jumps work. Furthermore, CPU jumps require some additional education, such as what macro-op fusion is and why you should make sure the loops you write can use it.
-
-
Replying to @cmuratori @chriseberly
This is something of a challenge, as what is macro-fusable differs quite a bit between architectures (and implementations of architectures). It’s good to be aware of, however.
1 reply 0 retweets 2 likes -
Replying to @stephentyrone @cmuratori
i guess i'll say part of my original point was that gotos have a logical translation to and from assembly/machine code and so they weren't simply invented as a "technique" for programming out of thin air that ultimately ended up being a bad idea or something like that
0 replies 0 retweets 0 likes
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.