This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-02-20
Channels
- # announcements (42)
- # babashka (70)
- # beginners (152)
- # chlorine-clover (19)
- # cider (14)
- # clj-kondo (23)
- # clojars (15)
- # clojure (86)
- # clojure-denmark (1)
- # clojure-dev (5)
- # clojure-europe (57)
- # clojure-france (145)
- # clojure-hungary (2)
- # clojure-italy (5)
- # clojure-nl (7)
- # clojure-spec (35)
- # clojure-sweden (2)
- # clojure-uk (58)
- # clojurebridge (1)
- # clojured (1)
- # clojurescript (50)
- # core-typed (9)
- # cursive (10)
- # data-science (11)
- # datascript (4)
- # datomic (25)
- # emacs (8)
- # fulcro (49)
- # graalvm (7)
- # graphql (6)
- # joker (1)
- # juxt (2)
- # kaocha (1)
- # off-topic (22)
- # other-lisps (1)
- # pathom (20)
- # re-frame (3)
- # reagent (11)
- # reitit (2)
- # remote-jobs (1)
- # shadow-cljs (44)
- # spacemacs (2)
- # sql (17)
- # tree-sitter (2)
- # vim (8)
- # vrac (2)
Has anyone experienced problems with reloading records/protocols in the REPL? I periodically have issues with that where it won’t recognize that my var is referencing a record that implements said protocol.
@ajarosinski are you re-defing the var as well, or just the record?
I think I’m re-defing the var. For example, I’ll fetch data from the DB in the REPL, convert that to a record and then try to reference the protocol functions on that record. This will fail sometimes if I’ve reloaded either the protocol/record in the incorrect order in the REPL
I think that's expected behavior for records. A record defines an accompanying class, and reloading it generates a new class, so instances that existed before the reload now point to the old class.
tools.namespace docs offers suggestions for structuring your codebase to be more repl friendly: https://github.com/clojure/tools.namespace
Stuart Sierra blog posts about his workflow are also useful: http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded
He automated some of it in this project https://github.com/stuartsierra/reloaded
I generally avoid using records/protocols exactly because they're not very REPL friendly
¯\(ツ)/¯
Thanks @U5FEGMC4D, I’ll read through those. @U236LQYB0, that’s a bummer that you avoid them for the REPL; I have really enjoyed them otherwise