Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

He writes "prepare to cringe" and he is not wrong. As far as I understand, this technique implements GOTO by reading the source code (again) into memory, filtering out everything before the target label and evaluating the remaining source code. I think this doesn't preserve state, variables etc. so not really a GOTO. But interesting technique.

edited for clarity



> I think this doesn't preserve state, variables etc.

Why wouldn't it? It's calling eval, not exec.


The more frightening part (at least for me) is the reddit thread that points out this is how windows batch files implement goto, and shows how to see it happen.


If that's the scariest thing you know about Windows batch files, you've lived a blameless life.


I’m just a babe in the woods


Does that mean using jumpto to jump to a label above that invocation results in redeclaration of the same code?

Seems janky even by the low standards of the author.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: