Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print unresolved recursive values as their defining expressions, instead of ?? #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/rmap/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
(print-method reftag *out*))

(defmethod print-method RVal [^rmap.core.RVal rval ^java.io.Writer writer]
(.write writer "??"))
(.write writer (str "(rval " (:ref/sexp (meta (.f rval))) ")")))

(defmethod simple-dispatch RVal [^rmap.core.RVal rval]
(print-method rval *out*))
Expand All @@ -64,7 +64,8 @@
not evaluated yet. The body can use the [[ref]] function while it is
evaluated, or you can bind it locally for use at a later stage."
[& body]
`(RVal. (fn [ref#]
`(RVal. ^{:ref/sexp '~@body}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unquote-splice would make the macro fail if the body contains multiple expressions like (rval (println "lazy!") "hi").

(fn [ref#]
(binding [ref ref#]
~@body))))

Expand Down