Fork me on GitHub
#leiningen
<
2022-05-26
>
Ho0man12:05:37

Hi everyone, We use lein checkouts (+ cider and spacemacs) extensively to develop across projects. We keep encountering a weird problem where for certain records and protocols we have to individually go to their namespaces and evaluate the buffer in order for them to be loaded. Has anyone had the same problem ? Is it related to lein? Thanks ---- More specifically these are the three types of errors we get as a result : 1. we get method does not implement the interface error on records that are already required 2. we get no method on multispecs whose corresponding namespaces are indeed required (and more generally on multimethods). To fix it we are sometimes forced to stop the repl, do lein clean and start again. 3. we get compilation failure for the current namespace on the require line for some problematic namespace. Then wen we switch to that namespace and reevaluate the buffer to fix this issue.

jumar12:05:02

Do you require the namespaces anywhere? Is the problem that they aren't evaluated at all or perhaps that there are stale definitions

Ho0man12:05:12

Yeah, they are required in the current namespace. Most of the time the problem seems to be that they are not evaluated at all. These are the three types of errors we get as a result : 1. we get method does not implement the interface error on records that are already required 2. we get no method on multispecs whose corresponding namespaces are indeed required (and more generally on multimethods). To fix it we are sometimes forced to stop the repl, do lein clean and start again. 3. we get compilation failure for the current namespace on the require line for some problematic namespace. Then wen we switch to that namespace and reevaluate the buffer to fix this issue. Thanks again @U06BE1L6T

jumar13:05:01

Sometimes there's a problem with aot compilation- like if you do lein uberjar in the same project and then start the repl the classes from the target dir might clash with repl trying to load the namespaces. Then of course if you reevaluate the protocol but forget to reeval implementations/records (notably if they are in different namespaces) then you will get a mismatch too (the old records instances no longer implement the new protocol instance)

1
👍 1