this post was submitted on 21 Jun 2024
38 points (100.0% liked)

Programmer Humor

19149 readers
1155 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] schnurrito@discuss.tchncs.de 1 points 2 months ago (5 children)

TBH I fail to see the significant difference between this and a function declaration.

[–] sxan@midwest.social 2 points 2 months ago (1 children)

Doesn't it steal control flow? More like a break point, except you define where execution continues.

I wonder if it's a compile error to have multiple conflicting COMEFROM statements, or if it's random, kind of like Go's select statement.

How awesome would it be to be able to steal the execution stack from arbitrary code; how much more awesome if it was indeterminate which of multiple conflicting COMEFROM frames received control! And if it included a state closure from the stolen frame?

Now I want this.

[–] davidgro@lemmy.world 1 points 2 months ago

I wonder if it's a compile error to have multiple conflicting COMEFROM statements

I think there's at least one INTERCAL implementation where that's how you start multi-threading

[–] sudo@programming.dev 1 points 2 months ago

Its like if subroutine bar could say its going to execute at line N of routine foo. But if you were just reading foo then you'd have no clue that it would happen.

You can simulate this effect with bad inheritance patterns.

[–] polonius-rex@kbin.run 1 points 2 months ago

it's semantic

at the end of the day everything boils down to sequence and branchifs

[–] palordrolap@kbin.run 1 points 2 months ago

I'd say it's more like setting up a handler for a callback, signal, interrupt or something along those lines.

Function declarations by themselves don't usually do that. Something else has to tell the system to run that function whenever the correct state occurs.

That doesn't account for unconditional come-froms.¸but I expect there'd have to be a label at the end of some code somewhere that would give a hint about shenanigans yet to occur. Frankly that'd be worse than a goto, but then, we knew that already.

[–] magic_lobster_party@kbin.run 1 points 2 months ago
print(A)
print(B)
hello: print(C)
print(D)
print(E)
comefrom hello
print(F)

This will print A, B, C and then F. D and E will be skipped because of the comefrom.