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

Error with #voc/lstr Language Tagged Strings in CLJS #32

Open
aamedina opened this issue Jun 1, 2023 · 7 comments
Open

Error with #voc/lstr Language Tagged Strings in CLJS #32

aamedina opened this issue Jun 1, 2023 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@aamedina
Copy link
Contributor

aamedina commented Jun 1, 2023

Issue: Error with #voc/lstr Reader Macro for Language Tagged Strings in RDF in CLJS

Description

I am encountering an issue when trying to use the #voc/lstr reader macro to support language tagged strings in CLJS. The expected output is not being produced, and instead, I am seeing compile exceptions.

Steps to Reproduce

  1. Run #voc/lstr "hello@en" in a CLJS REPL. This results in a compile exception: failed compiling constant: hello; ont_app.vocabulary.lstr.LangStr is not a valid ClojureScript constant.
  2. Run (ont_app.vocabulary.lstr.LangStr.). This results in #voc/lstrundefined@undefined.
  3. Run (ont-app.vocabulary.lstr.LangStr.). This also results in #voc/lstrundefined@undefined.
  4. Run (ont-app.vocabulary.lstr/->LangStr "hello" "en"). This results in #voc/lstrhello@en.

Expected Behavior

The expected output when running #voc/lstr "hello@en" is #voc/lstr "hello@en".

Actual Behavior

Instead of the expected output, we're seeing compile exceptions and incorrect output.

Additional Information

Thank you for your work on this library.

@ont-app
Copy link
Owner

ont-app commented Jun 1, 2023

Hmm. The unit tests are working. Sorry but I don't play on the cljs side much, and when I do, I typically use shadow. Could you give me instructions for entering the cljs environment that triggers this error?

Thanks for logging this BTW.

@aamedina
Copy link
Contributor Author

aamedina commented Jun 1, 2023

From Emacs I do

M-x cider-jack-in-cljs > figwheel-main > dev

From CLI I do:

clojure -M:dev -m figwheel.main -b dev -r

Everything loads normally in CIDER except the reader macro for the LangStr doesn't print correctly and I can't use the #voc/lstr literals. However in Clojure CLI it works. If I require a namespace (like https://github.com/aamedina/rdf/blob/main/src/cljc/net/wikipunk/rdf/as.cljc) with lstrs I can load it and even see the lstrs but they print malformed as I reported.

@ont-app
Copy link
Owner

ont-app commented Jun 1, 2023

Do you think you could give me a minimal deps.edn?

Also, (ont-app.vocabulary.lstr/->LangStr "hello" "en") should actually be throwing an error. It only expects one argument, e.g. "hello@en"

Edit: sorry, I was working off of memory. You are correct

@aamedina
Copy link
Contributor Author

aamedina commented Jun 1, 2023

Isn't that the constructor for the deftype? It should accept 2 positional args.

{:deps
 {org.clojure/clojure
  {:mvn/version "1.12.0-alpha3"}
  com.cognitect/transit-clj
  {:mvn/version "1.0.333"}
  com.cognitect/transit-cljs
  {:mvn/version "0.8.280"}
  io.github.aamedina/rdf
  {:git/sha "264ac9dbce0ff2f354a3bd0175c56c88abcce882"}
  org.clojure/clojurescript
  {:mvn/version "1.11.60"}
  reagent/reagent
  {:mvn/version "1.2.0"}
  cljsjs/react
  {:mvn/version "17.0.2-0"}
  cljsjs/react-dom
  {:mvn/version "17.0.2-0"}}
 :paths ["src/clj" "src/cljc" "src/cljs" "classes" "resources" "target"]
 :aliases
 {:dev
  {:extra-deps
   {com.bhauman/figwheel-main
    {:mvn/version "0.2.18"}
    com.bhauman/rebel-readline-cljs
    {:mvn/version "0.1.4"}}
   :extra-paths ["dev"]}}}

@ont-app ont-app added the bug Something isn't working label Jun 3, 2023
@ont-app
Copy link
Owner

ont-app commented Jun 16, 2023

I haven't had a chance to really wrestle this problem to the ground, but early indications suggest that this might be a problem with the cider or nrepl render custom tags.

@ont-app
Copy link
Owner

ont-app commented Jun 7, 2024

Traced this to a problem in piggieback.

Logged this issue: nrepl/piggieback#128

@aamedina
Copy link
Contributor Author

aamedina commented Jun 7, 2024

Nice job tracking that down!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants