Comments (12)
I'm not super familiar with the trade-offs
I think one answer could be: we're not trying to be better than Clojure, EDN or JSON and protect you from their pitfalls.
from clerk.
As far as I understand, Clerk uses EDN to transport data from the JVM to the browser and spaces in keywords doesn't seem to work with EDN (some context in taoensso/sente#251)
Transit does support this but it looks like there is already a lot of code in place around EDN, via edamame, so I imagine that migrating to transit isn't worth it.
I'm not super familiar with the trade-offs between the two formats, so I'm curious: would it be theoretically possible to switch from EDN to Transit without loosing existing features? @mk and @borkdude, do you know?
from clerk.
Evaluating:
[(hash-map (keyword "N hello") [1 2 3])]
;;=> [{:N hello [1 2 3]}]
Parsing [{:N hello [1 2 3]}]
is what you see the error message about.
from clerk.
I think it breaks at several places, but one I expect would be usages of edamame in nextjournal.clerk.hashing/read-string
where (nextjournal.clerk.hashing/read-string ":a a") ;; => :a
The other somehow the notebook shows the viewer/value datastructure instead of rendering the keyword. When it renders this datastructure it shows the error mentioned by @behrica
from clerk.
I'll look at this later today.
from clerk.
I think the problem is that programmatically constructed keywords or symbols (via keyword
and symbol
) must not be readable so unsure if there's something actionable here.
See also Why is it possible to create keywords that canβt be read by the reader?
from clerk.
I think one answer could be: we're not trying to be better than Clojure, EDN or JSON and protect you from their pitfalls.
yeah, I was thinking that that would be a fine place to leave it. Like, Clerk depends on transferring data via EDN, so it will choke on whatever EDN doesn't support
from clerk.
The philosophical questions is more, how "compatible" Clerk need to be with "an arbitrary .clj file".
So far I have the expectation that any valid .clj file can be rendered/executed as well by Clerk without error.
(Otherwise it is a bug in Clerk)
But maybe it is a too wide expectation , but current Clerk announces as
Clerk takes a Clojure namespace and turns it into a notebook:
which implies "takes any namespace".
I made similar comments regarding the fact that the Clerk caching cannot cache everything.
Eventually we should communicate more clearly, that Clerk has certain requirements for being able to execute / render a Clojure namespace. (and keywords with spaces would then be unsupported to render).
I would still say, Clerk should "guaranty" to "execute" all lines of any .clj file (if valid Clojure).
It might "not render some values" (or not cache them), but we should strive for "successful execution".
from clerk.
Maybe it would make sense to catch the "sci read error" on ClojureScript side and show in the browser a more friendly message, which indicates that the current value "cannot be rendered by Clerk".
from clerk.
I just learned that "spaces are illegal in keywords", even though they can be created via the keyword function.
In this case I would suggest as well to close this issue.
from clerk.
I would suggest as well to close this issue.
I agree π. Also agree that there's plenty of holes in the documentation that need to be filled but I don't want to track those in issues just yet.
from clerk.
Since dropping the edn in edn encoding for results this leads to a global failure (instead of being contained to a single result). This occurred again today https://clojurians.slack.com/archives/C035GRLJEP8/p1670105206417629
from clerk.
Related Issues (20)
- Problems with tablecloth HOT 1
- Exceptions are not shown when watcher uses filter-fn HOT 1
- Source File is missing from git Links in Header of static App
- Viewer crashes trying to present exceptions with function values in their data
- static builds should include git links to source documents
- # anchors in links to static builds don't work in Firefox when first opening a page
- Consider adding a specific code example to `clerk/use-headers` or `clerk/table` docstring?
- An edge case where the analyzer crashes
- clerk/image should have an option to set the size HOT 2
- clerk/image should have have an option to encode images as jpeg
- clerk/image should have an option to include an `alt` tag
- The :no-cache option does not propagate through dependencies across files HOT 1
- Inline redefs crash during eval HOT 1
- Improve error message when predicate throws
- Browser UI disappears when exception is thrown HOT 5
- Clerk cannot render nested wrapped values HOT 2
- Clerk doesn't load in java 22 HOT 5
- Top-level multiline strings are not rendered HOT 1
- Scroll position lost after browser refresh / error popup
- honey.sql format crashes in clerk notebook HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clerk.