LuKuangChen / stacker-2023

A notional machine for the SMoL languages
15 stars 0 forks source link

codemirror not updated #34

Open LuKuangChen opened 3 months ago

LuKuangChen commented 3 months ago

    #lang smol/what-ever

(deffun (make-counter)
  (defvar n 0)
  (deffun (inc)
    (set! n (+ n 1))
    n)
  inc)
(defvar f (make-counter))
(f)
(f)

The first time I paste in this program, the stacker is able to remove the #lang. However, if hint run and then stop and then select all and then paste the program in again, the editor won't update itself, although all of the remaining part of the stacker seems to read the newly pasted program as if #lang does not exist. Weird bug.

LuKuangChen commented 3 months ago

Suggestion from Nathaniel Miller

Yes, I had also noticed that strange behavior when playing with this. I wonder if it would make more sense to have the stacker treat a #lang line as a comment rather than deleting it. People may be confused by paste working differently than they expect. I had originally pasted the code in with an extra carriage return before the #lang, and then when I deleted the carriage return the #lang line also disappeared, which surprised me.