News for hackers. Stuff that matters.
Re:Common Lisp: An Interactive Approach (1992) [pdf] by coliveira on Tuesday October 10, 2023 @09:17PM (#37839849)
Python doesn't work well for repl development. You cannot set the current module in Python as you can do in Lisp. So you're restricted to make changes to the current module. Also, debugging in the repl is not as powerful in Python.
Re:Common Lisp: An Interactive Approach (1992) [pdf] by sillysaurusx on Tuesday October 10, 2023 @09:23PM (#37839890)
Sure it does. Just paste the defs into the repl.

You can also use `from importlib import reload` and then have an expression like reload(foo).bar() to constantly reload your foo library.

Re:Common Lisp: An Interactive Approach (1992) [pdf] by kqr on Wednesday October 11, 2023 @02:01AM (#37841428)
But this means you have to litter your application with support for it, doesn't it? In Common Lisp, I can stop at a breakpoint, paste in a new definition of any function in the application, and then resume and it will use the new definition everywhere rather than the one that existed when the breakpoint was triggered: https://two-wrongs.com/debugging-common-lisp-in-slime.html
Re:Common Lisp: An Interactive Approach (1992) [pdf] by vindarel on Wednesday October 11, 2023 @03:08AM (#37841780)
*and not only paste, but write, in the source file, the new definition, re-compile it (C-c C-c), and resume execution from a stackframe before this call. (a clarification for folks who would think we must paste in the REPL)

That's useful not only for breakpoints but for errors. We can fix an error without re-running everything from zero. https://www.youtube.com/watch?v=jBBS4FeY7XM

Re:Common Lisp: An Interactive Approach (1992) [pdf] by oalae5niMiel7qu on Wednesday October 11, 2023 @06:12AM (#37842708)
Reload only reloads one copy of the module. If there are other modules that imported the same module, your new definition will not be seen by them unless you find all the copies of foo in memory and reload them also. Since there's no reliable way to do that, you're more likely to just restart Python all the time.
Re:Common Lisp: An Interactive Approach (1992) [pdf] by gilch on Monday October 16, 2023 @04:28PM (#37906075)
Not accurate as worded. Python caches module imports in `sys.modules`, so all imports get the same one. A `reload()` will reuse the same dict object that was being used as the module's namespace, so everything with a reference to the module object will see the same namespace and get the updates.
Re:Common Lisp: An Interactive Approach (1992) [pdf] by mathisfun123 on Tuesday October 10, 2023 @10:10PM (#37840129)
This is basically either ignorance or a lie spread by lispers but you're wrong. You can look through my history and find my last slap fight with someone proclaiming SLIME as the one true repl. The only thing you can't do in Python (or any other sane language that I know about) that you can do in lisp is catch a stack unwind due to error (you can only break as the stack is being unwound).
Re:Common Lisp: An Interactive Approach (1992) [pdf] by dang on Tuesday October 10, 2023 @10:35PM (#37840273)
Whoa, please don't take HN threads into programming language flamewars, "slap fights", or attacks on other users. We're trying to avoid all that here.

https://news.ycombinator.com/newsguidelines.html

Re:Common Lisp: An Interactive Approach (1992) [pdf] by mathisfun123 on Tuesday October 10, 2023 @11:18PM (#37840504)
I didn't say this should be a slap fight - I said the last one was. I'm always at a loss with how reading comprehension should lead people to conclude X here but instead they conclude Y. Like it literally says the previous one ie I don't know how I could've made it any clearer.

Also you're perpetual quoting of the rule book under the guise of "here's our credo" doesn't accomplish anything because it doesn't clarify what rule was broken (and just serves to obscure the censure under "we don't like your kind around here"). At minimum you should cite exactly what rule was broken.

Re:Common Lisp: An Interactive Approach (1992) [pdf] by dang on Wednesday October 11, 2023 @01:11AM (#37841111)
You broke the rules against flamebait and calling names.

If you'd just make your comments less aggressive, it would be much better.

Re:Common Lisp: An Interactive Approach (1992) [pdf] by forward-slashed on Tuesday October 10, 2023 @10:59PM (#37840386)
Check out lpy-mode
Re:Common Lisp: An Interactive Approach (1992) [pdf] by gilch on Monday October 16, 2023 @04:19PM (#37905941)
What? Yes you can. I do it all the time.

    import code; code.interact(local=vars(foo))
where `foo` is the module object you want to set as current. This launches a subREPL in that module's namespace. (EOF kills the subREPL and returns to main.)

Python has a debugger in the standard library that can also do post-mortem inspections.