Fix #770 by moving var outside of value#812
Open
borkdude wants to merge 3 commits into
Open
Conversation
Previously the result of a `(def foo v)` was stored as
`{:var-from-def #'foo :var-snapshot v}` inside `:nextjournal/value`.
Viewers that saw this map had to either opt out via `:var-from-def?`
or tolerate being handed a metadata wrapper instead of the value.
This caused #770 (crash on `clerk/row` + def) and produced confusing
output when viewer fns like `clerk/row`/`col` ran on defs.
Now the value itself goes in `:nextjournal/value` and the var
reference goes in `:nextjournal.clerk/var-from-def` on the wrapped
value. `apply-viewer-to-result` copies the sidecar forward, and
`render-eval-viewer`'s `:transform-fn` reads it for SCI resolution.
Removes `var-from-def?`, `var-from-def-viewer`,
`maybe-wrap-var-from-def`, and the `:var-from-def?` opt-out flag.
SCI evaluates a bare symbol `ns/foo` to the var's value (the atom), but `(resolve 'ns/foo)` returns the var itself. Viewers like `editor-sync-viewer` expect the atom, so the bare-symbol form is what matches the old behavior.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously the result of a
(def foo v)was stored as{:var-from-def #'foo :var-snapshot v}inside:nextjournal/value.Viewers that saw this map had to either opt out via
:var-from-def?or tolerate being handed a metadata wrapper instead of the value.
This caused #770 (crash on
clerk/row+ def) and produced confusingoutput when viewer fns like
clerk/row/colran on defs.Now the value itself goes in
:nextjournal/valueand the varreference goes in
:nextjournal.clerk/var-from-defon the wrappedvalue.
apply-viewer-to-resultcopies the sidecar forward, andrender-eval-viewer's:transform-fnreads it for SCI resolution.Removes
var-from-def?,var-from-def-viewer,maybe-wrap-var-from-def, and the:var-from-def?opt-out flag.