This is the same language where you have to say PLEASE sometimes or it won't compile. But if you say PLEASE too much, the compiler will think you're pandering and also refuse to compile. The range between too polite and not polite enough is not specified and varies by implementation.
I love how arbitrary, cultural and opinionated that must be to work with. You'd learn something about the implimenter of the compiler by using it for a while.
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?
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.
A function will be called by code and go to that point in code. To implement functions, you store necessary things to memory and goto the function definition. To implement that with comefrom you'd have to have a list of all the places that need to call the function as comefroms before the function definition. It'd be a mess to read. We almost never care where we are coming from. We care where we're going to. We want to say "call function foo" not "foo takes control at line x."
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.
I don't see any case where this is better than a goto. A goto you can read progressively though. A comefrom you'd see written then have to track to that piece of code and remember there's a potential hidden branch there.
33 Comments
pro3757@programming.dev · 113 pts · 2y
It's in Intercal, a joke language from '70s. Mark Rendle describes it here in his talk at NDC. This whole talk is ridiculous btw.
frezik@midwest.social · 160 pts · 2y
This is the same language where you have to say
PLEASEsometimes or it won't compile. But if you sayPLEASEtoo much, the compiler will think you're pandering and also refuse to compile. The range between too polite and not polite enough is not specified and varies by implementation.Whelks_chance@lemmy.world · 25 pts · 2y
I love how arbitrary, cultural and opinionated that must be to work with. You'd learn something about the implimenter of the compiler by using it for a while.
c0smokram3r@midwest.social · 10 pts · 2y
Sonotsugipaa@lemmy.dbzer0.com · 72 pts · 2y
Wh... what do you mean, "originally as a joke"?
rand_alpha19@moist.catsweat.com · 39 pts · 2y
mossy_@lemmy.world · 36 pts · 2y
Guy who worked at my place before me kept using these and GOTO statements all over the place.
His name? Cotton-eyed Joe
hakunawazo@lemmy.world · 8 pts · 2y
Thanks for the catchy tune, now the song sticks in my mind again. Last time was long time ago. :)
match@pawb.social · 8 pts · 2y
Reference to Cottoneyed Joe considered harmful
mossy_@lemmy.world · 3 pts · 2y
I almost spat out my drink when I saw this
lseif@sopuli.xyz · 8 pts · 2y
where did you COMEFROM where did you GO.....TO
match@pawb.social · 5 pts · 2y
where did you COMEFROM, cottonEyedJoe2
s12@sopuli.xyz · 35 pts · 2y
PLEASE COMEFROM 🏷
neo@lemy.lol · 29 pts · 2y
COMEFROM is my go to function;
onlinepersona@programming.dev · 23 pts · 2y
I honestly thought C++ (aka dumping ground of programming concepts) would implement this for "completeness".
Anti Commercial-AI license
NeatNit@discuss.tchncs.de · 8 pts · 2y
They should add it in C++26
uis@lemm.ee · 1 pts · 2y
C++60
MajinBlayze@lemmy.world · 21 pts · 2y
So, an aspect
polonius-rex@kbin.run · 9 pts · 2y
shut your mouth
RiikkaTheIcePrincess@pawb.social · 17 pts · 2y
Aaahhh, this is horrifying! You've ruined my breakfast 🙀
schnurrito@discuss.tchncs.de · 10 pts · 2y
TBH I fail to see the significant difference between this and a function declaration.
sxan@midwest.social · 28 pts · 2y
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 · 10 pts · 2y
I think there's at least one INTERCAL implementation where that's how you start multi-threading
magic_lobster_party@kbin.run · 9 pts · 2y
This will print A, B, C and then F. D and E will be skipped because of the comefrom.
palordrolap@kbin.run · 5 pts · 2y
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.
Cethin@lemmy.zip · 4 pts · 2y
A function will be called by code and go to that point in code. To implement functions, you store necessary things to memory and goto the function definition. To implement that with comefrom you'd have to have a list of all the places that need to call the function as comefroms before the function definition. It'd be a mess to read. We almost never care where we are coming from. We care where we're going to. We want to say "call function foo" not "foo takes control at line x."
polonius-rex@kbin.run · 4 pts · 2y
it's semantic
at the end of the day everything boils down to sequence and branchifs
sudo@programming.dev · 2 pts · 2y
Its like if subroutine
barcould say its going to execute at line N of routinefoo. But if you were just readingfoothen you'd have no clue that it would happen.You can simulate this effect with bad inheritance patterns.
lseif@sopuli.xyz · 6 pts · 2y
more practical than goto
Thcdenton@lemmy.world · 6 pts · 2y
starman@programming.dev · 5 pts · 2y
Looks like C# 12 interceptors:
I know it looks awful, but it's not intended for direct use, but rather for source generators for native ahead of time compilation.
https://andrewlock.net/exploring-the-dotnet-8-preview-changing-method-calls-with-interceptors/
umbrella@lemmy.ml · 4 pts · 2y
Cethin@lemmy.zip · 16 pts · 2y
I don't see any case where this is better than a goto. A goto you can read progressively though. A comefrom you'd see written then have to track to that piece of code and remember there's a potential hidden branch there.
MindTraveller@lemmy.ca · 6 pts · 2y
It's basically a simpler version of a callback
MadMadBunny@lemmy.ca · 3 pts · 2y
You’re gonna love HCF then!
jbk@discuss.tchncs.de · 2 pts · 2y
til