This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-01-18
Channels
- # announcements (19)
- # babashka (30)
- # beginners (51)
- # biff (12)
- # calva (20)
- # cider (27)
- # clara (20)
- # clj-kondo (19)
- # clojure (128)
- # clojure-canada (1)
- # clojure-dev (5)
- # clojure-europe (29)
- # clojure-nl (1)
- # clojure-norway (48)
- # clojure-uk (5)
- # clojurescript (6)
- # clr (37)
- # core-async (17)
- # cursive (2)
- # data-oriented-programming (2)
- # datahike (1)
- # datomic (5)
- # emacs (22)
- # exercism (1)
- # funcool (17)
- # humbleui (15)
- # jobs (1)
- # malli (44)
- # off-topic (11)
- # podcasts-discuss (1)
- # pomegranate (1)
- # react (1)
- # remote-jobs (1)
- # shadow-cljs (25)
- # tools-build (12)
- # tools-deps (70)
- # xtdb (24)
I'm not able to comment on CLJ-2743 directly so I figured I would add some input here about why I think that behavior is being seen. In the JVM the catch block of a thrown exception is always stack clearing (JVMS §6.5 athrow), but at the language level Clojure presents 'try' as a simple expression which doesn't have that non-local behavior. The problem is with expressions like [1 2 (try (something) (catch Exception e 3))]. The stack frame entering into the catch is only going to be (exception) not (1, 2, exception). Essentially, the compiler needs to save the existing stack frame when it encounters a 'try' otherwise it loses those stack elements if the catch is executed. The mechanism to save these existing stack elements seemed to be to copy the entire try block into a separate function and run that. This has the benefit that the frame cleared is not the current stack frame. The downside is the synthetic closure created shadows existing symbols.
Yes, if you search for clj-2743 there is some discussion of this that didn't get copied to the ticket https://clojurians.slack.com/archives/C03S1KBA2/p1671647482679789?thread_ts=1671643575.912139&cid=C03S1KBA2
And there are other issues like https://clojure.atlassian.net/browse/CLJ-701 which are also a result of the simple hoisting the compiler does
Ah, I only checked the ask clojure thread and both of the related tickets. I'll check backchat next time too. Thanks!
just fyi, you can comment on the Ask Clojure issue instead of the jira, that's what it's for. we look at both when working on stuff