@wilfredh One of the saddest facts
Jack Rusher@jack@berlin.social
@jack @wilfredh
(define (f) 25)
C-x C-e
(define (g)
(+ (f) 10))
C-x C-e
(g)
C-x C-e -> 35
(define (f)
40)
C-x C-e
(g)
C-x C-e -> ???
Panicz Maciej Godek@PaniczGodek@functional.cafe
@jack @wilfredh
I mean, I'd expect The Right Thing to be the interface saying something like:
"You are about to redefine the function f, which is called by g. Do you want g to:
1. refer to the previous definition of f?
2. refer to the new definition of f, and update all functions that depend on g
3. refer to the new definition of f, and review the functions that depend on g
..."
Panicz Maciej Godek@PaniczGodek@functional.cafe
@PaniczGodek
What if we used a declaration of SPACE optimization written in a 1988 compiler's user guide to determine which behaviour happens in context though.
@jack @wilfredh
screwlisp@screwlisp@gamerplus.org
@screwlisp @jack @wilfredh
as Felleisen's quote goes,
"it is difficult for masters of the universe with 30 years of experience to keep track of things. What do you think students with 10 or 20 days worth of experience will do?"
Panicz Maciej Godek@PaniczGodek@functional.cafe
@PaniczGodek @jack @wilfredh Common Lisp kind of does that, and has an arguably reasonable standard behavior for these cases 🌚
Artyom Bologov@aartaka@merveilles.town
@aartaka @jack @wilfredh
I just tried with SBCL, and it only gave me a redefinition warning
Panicz Maciej Godek@PaniczGodek@functional.cafe
@PaniczGodek @jack @wilfredh yes, right. I guess I had the dangerous behavior case with generics. Still, redefinition warning+standard (use the new definition whenever it’s available IIRC) is good enough for me.
Artyom Bologov@aartaka@merveilles.town
@aartaka @jack @wilfredh I mean, to me most of the time using C-x C-e for e.g. writing a data analysis program is good enough
But I was once demoing the evaluation feature of GRASP to a (non-programming) friend, and he found it very confusing. His belief was that if I write
(define x 5)
then I shouldn't have to evaluate the definition in order for x to be 5. The whole concept of "underlying interpreter state" was very awkward to him.
And I think that in some sense he was right. I'm not sure it was the same sense Felleisen had in mind when he was conceiving of Dr Racket, though (which in my experience just isn't fun to use, for many reasons)
Panicz Maciej Godek@PaniczGodek@functional.cafe
@PaniczGodek @aartaka @wilfredh The concept of “underlying interpreter state” is the same as the concept of “we are having a conversation so you remember what I told you before”, and the benefits of interactive programming so outweigh the possibility of confusion that I have little sympathy for this argument…
Jack Rusher@jack@berlin.social
@jack Excel though. We can (theoretically) have immediately reactive programming that maps onto the interactive mindset even better. You wrote it — it’s there, running.
But I don’t agree with that approach myself:
– Weak complaint: it can get broken much easier than “regular” interactive program. It’s weak, because it’s probably solvable with exactly the kind of guardrails @PaniczGodek suggests.
- Stronger complaint: remembering evaluated things is a better strategy, because it allows for finer control of side effects and codebases (you can version-control files without evaluating them, and that’s good.) The world is messy and stateful, we shouldn’t act on it in an immediate way, much like we shouldn’t put out untested/unaudited vibecoded stuff there.
@wilfredh
Artyom Bologov@aartaka@merveilles.town
@wilfredh I've wanted a buffer to accrete what I've written in an interpreter. I can understand the reasoning.
Shae Erisson@shapr@recurse.social
@PaniczGodek
It is just 50, right? Is there supposed to be a trick?
@jack @wilfredh
Dan :guix:@danielittlewood@fosstodon.org
@jack @wilfredh
There is XREPL
https://docs.racket-lang.org/xrepl/
Personally I’m fine with DrRacket repl. It compiles so fast it’s not like I’m waiting.
Stephen De Gabrielle@spdegabrielle@functional.cafe
@jack That's how I started my last Python courses for scientific computing. The first lesson was about conversing with an interpreter, about state, and reference semantics (aliasing etc.). And I regularly added remarks about these issues in later lessons.
@PaniczGodek @aartaka @wilfredh
Konrad Hinsen@khinsen@scholar.social
@PaniczGodek @aartaka @jack I'm definitely sympathetic to the view that it hurts beginners, but incremental redefinition is such a wonderful workflow that I miss it often.
Smalltalk definitions tend to be very small, so it suffers less from the problem you describe. The interpreter state tends to be closer to the source code state.
Wilfred Hughes
@PaniczGodek @aartaka @jack I'd also argue that differing definitions is still a problem in languages without a REPL!
As soon as you change a database schema, or gradually deploy a system with new features, or deserialise data from an old version, or have non-trivial JS calling backend code, you have similar issues.
Wilfred Hughes
@PaniczGodek @aartaka @jack I am working in a toy PL (Garden) in this space, but details like go-to-def logic become more complicated when you allow redefinition.
Wilfred Hughes
@wilfredh @PaniczGodek @aartaka Are you assuming that the editor will be connected to a live system that can show you the source code of a given function when it was last compiled? In that scenario, the only tricky bit is the UX to show the difference between what’s in the file/on-disk and what has been compiled in the running image…
Jack Rusher@jack@berlin.social
@jack @PaniczGodek @aartaka Yeah, exactly.
The devil's in the details though. If the loaded function was on line 20, do you try to find the current version on line 25, or just pop up a buffer of the loaded version? Where does the user then edit?
One idea I've been thinking about is making the interpreter session speak LSP. That way you'd have go-to-def and completion based on loaded definitions, but it's unconventional.
Wilfred Hughes
@wilfredh but wait, isn’t LSP file-oriented? Clojure one is, and it sucks.
@jack @PaniczGodek
Artyom Bologov@aartaka@merveilles.town
@aartaka @jack @PaniczGodek Well, LSP reflects the state of the editor: the editor sends didOpen at the start, then didChange on every edit. So the server knows the editor state even without saving.
Sounds like you have a different model in mind though?
Wilfred Hughes
@wilfredh no, I simply didn’t know about it! Thanks for the details!
@jack @PaniczGodek
Artyom Bologov@aartaka@merveilles.town