This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-08-28
Channels
- # anglican (2)
- # announcements (2)
- # babashka (41)
- # babashka-circleci-builds (1)
- # beginners (45)
- # brompton (2)
- # calva (13)
- # cider (13)
- # clj-kondo (14)
- # cljsrn (6)
- # clojure (60)
- # clojure-europe (4)
- # clojure-nl (3)
- # clojurescript (1)
- # code-reviews (3)
- # conjure (2)
- # cryogen (5)
- # datomic (22)
- # fulcro (13)
- # graalvm (19)
- # introduce-yourself (1)
- # kaocha (2)
- # leiningen (2)
- # lsp (1)
- # malli (4)
- # meander (1)
- # music (1)
- # news-and-articles (2)
- # off-topic (17)
- # polylith (6)
- # practicalli (2)
- # react (15)
- # reactive (1)
- # reagent (8)
- # reitit (2)
- # releases (1)
- # rum (10)
- # shadow-cljs (6)
- # spacemacs (4)
- # sql (2)
- # tools-deps (4)
- # xtdb (21)
Hey team, would love your opinion on something:
I’m writing a lisp interpreter, which eventually will run PG’s Bel.
Right now, I’m trying to support continuations.
https://github.com/stopachka/bel-clojure/pull/2/files
To make things simple, my eval
was recursive, and to support continuations, I used callbacks.
(bel-eval env form done-f)
But, since supporting continuations, I found that this has quickly led to stack overflow.
Curious, how would you tackle it?
Am currently thinking of representing my own stack, so bel-eval would no longer be recursive: it would work on top of a stack, that I pass around and update as needed.
(let [stack (atom [x])]
;; take first element,
;; based on work, pass `stack` to other functions
;; other functions can add to the stack
If I go this approach though, am already worried that it’s going to get complicated, and I’m going to need some custom “breakpoints”, to get back to the right places in the code.
Is there another way you’d approach it?Hah, you know what, can just try to increase the stack size for now 😅. Still open for new ideas though!
@stopachka you have a couple of option:
a. reify the stack. Look at malli
's regex schema for an example
b. Just target project loom which has continuations