4 ms·
A REPL isn't just a REPL. You are comparing modern day Toyota Corollas to a Spaceship sent from the future to the 80s. One is just different level radical. At l
by xbpx 3y ago
A REPL isn't just a REPL. You are comparing modern day Toyota Corollas to a Spaceship sent from the future to the 80s. One is just different level radical.
At least when it's baked by SLY or SLIME
- mathisfun123 3y agohere is the list of slime features on the slime webpage >Code evaluation, compilation, and macroexpansion. >Online documentation (describe, apropos, hyperspec). >Definition finding (aka Meta-Point aka M-.). >Symbol and package name completion. >Automatic macro indentation based on &body. >Cross-reference interface (WHO-CALLS, etc). https://slime.common-lisp.dev/ https://slime.common-lisp.dev/ and i'm still wondering which of these things i can't do in a python repl? note macroexpansion doesn't count because that's not a dimension of the repl.
- CraigJPerry 3y ago>Code evaluation, compilation I couldn’t debug the following in pycharm and add the missing function at runtime, or could i? def interactively_writing_code(): this_doesnt_exist_yet() interactively_writing_code() I don’t think i can patch a function at runtime without losing state either in python - the act of redefining the function causes the variables to be reset but in lisp the bindings are untouched.
- mathisfun123 3y agoI just did it - it works perfectly fine. Debug-run your code, an exception will be thrown at the call site, step up one frame from the exception (ie module level), define the missing function, call again and it succeeds - all without leaving the same repl instance. Don't believe me? Try it. I'll say it again: you guys are in plain denial not about python or lisp as languages but about how interpreters work. There's just nothing more to be said about this dimension of it.
- yaantc 3y agoCalling again and continuing are not the same thing. Sure, with the above trivial example it is. But if the parent function has non idempotent code before calling the missing function (like doing some global change / side effects), then calling again will give a different result than just continuing from the current state. So is it possible to define the missing function and continue from the same state in Python? I don't think so, but I'm not a heavy Python user (just for small/medium scripts).
- mathisfun123 3y ago>So is it possible to define the missing function and continue from the same state in Python? I don't think so, but I'm not a heavy Python user This is a pointless debate - someone has to catch the exception, save caller registers, handle the exception (if there's a handler) or reraise. Either you have to do it (by putting a try except there) or your runtime has to be always defensively saving registers or something. Lisp isn't magic, it's just a point on trade-off curve and I have without a shadow of a doubt proven that that point is very close to python (wrt the repl). So okay maybe clisp has made some design decisions that make it a hair more effective at resuming than python. Cool I guess I'll just ignore all the other python features where there's parity or advantage because of this one thing /s.
- versteegen 3y agoI'll take this as an answer to my sibling comment that the answer is "No". I'm really sad CPython can't do that, but maybe some other Python can. It shouldn't necessarily be any slower for the interpreter to figure out where to jump to before saving the execution trace and jumping. It's not "pointless", I was tearing out my hair and losing days because I couldn't do this in CPython. Yes, I'd much rather use Python than Common Lisp regardless.
- lispm 3y agoThis works in compiled Lisp code.