The code I took was from a programming language I found at r/programminglanguages it's function requires that arg because it's a built in function and u can't know what function need context and what does not so you just pass it to every of them. Fucking on the function object because the function does not accept any arguments. It returns a boolean incase smth unexpected happened. The method is part of a builtin function that has some global info stuff for the language
Yes, I thought it could be something like this, baby's first dispatcher. It still smells. There's probably something like getattr(self, "execute_"+command_name)(exec_ctx) as well.
Sure, but just looking at this I was trying to contextualize what they were looking to do in the first place. Why would you pass 'cls' to os.system and what the context of RTResult() was. Obviously the pointless if statement is the issue, but I didn't get that far.
Haha I remember using this tutorial before. One day check out crafting interpreters by Robert Nystrom, teaches how to implement a VM based interpreter rather than a tree-based interpreter.
29
u/[deleted] Apr 17 '23
Should be
os.system("cls" if is.name == "nt" else "clear")right?10
u/IlliterateJedi Apr 17 '23
Can someone explain the context on this and why it's intrinsically bad?
15
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Apr 17 '23
Image Transcription: Code
I'm a human volunteer content transcriber and you could be too! If you'd like more information on what we do and why we do it, click here!
1
u/ay88407 Apr 19 '23
Haha I remember using this tutorial before. One day check out crafting interpreters by Robert Nystrom, teaches how to implement a VM based interpreter rather than a tree-based interpreter.
1
u/anatomiska_kretsar May 09 '23
What font is this?
3
u/AeroSyntax Apr 17 '23
I just realized that I've invoked cls more than ten thousand times in my life and I still don't know what this acronym stands for.