Coder Social home page Coder Social logo

Comments (12)

borkdude avatar borkdude commented on May 17, 2024 1

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.

philomates avatar philomates commented on May 17, 2024

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.

borkdude avatar borkdude commented on May 17, 2024

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.

philomates avatar philomates commented on May 17, 2024

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
20220407_14h59m54s_grim

from clerk.

borkdude avatar borkdude commented on May 17, 2024

I'll look at this later today.

from clerk.

mk avatar mk commented on May 17, 2024

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.

philomates avatar philomates commented on May 17, 2024

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.

behrica avatar behrica commented on May 17, 2024

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.

behrica avatar behrica commented on May 17, 2024

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.

behrica avatar behrica commented on May 17, 2024

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.

mk avatar mk commented on May 17, 2024

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.

mk avatar mk commented on May 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.