Comments (3)
I haven't put code to this yet but if I'm understanding the issue right:
When we're in the macroexpansion phase of compiling a CLJS file, our tagged values i.e. #js [(use-state 10)]
have already been read and are now an opaque JSValue
type, defined here: https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/tagged_literals.cljc#L68
Thus, we need a way of getting the form that is wrapped in this JSValue in order to continue analyzing.
I can think of two ways of doing this:
- Special case the analyzer to detect
JSValue
and access the field(.-val x)
- Define a protocol that we extend to
JSValue
to handle the field access
Using polymorphism for this makes me feel clever, since it would allow outside extension to other reader tags i.e. #hiccup [:div (when true (use-state "hello"))]
.
I am dubious of the times that this will actually be useful, though.
from helix.
I'm not sure if #hiccup
would apply here, as that's unable to return a special form without extending the ClojureScript compiler. That means #hiccup
has to return a record, list, etc. for the compiler to interpret.
The polymorphic approach was a little annoying because you had to extend it to Object
, nil
, etc.
from helix.
from helix.
Related Issues (20)
- Infinite loop with IStateUpdater HOT 1
- "Provider" property access getting mangled by :optimizations :advanced HOT 5
- Remove es6 mention from readme HOT 1
- Update README to use React 18 createRoot api
- No dependency named react-dom/client HOT 3
- Confusing syntax with `wrap` and args destructuring HOT 1
- goog.object/extend is deprecated
- Setup cljstyle config, run in CI
- Any good way to make multimethods work as component functions? HOT 8
- gensym / anonymous function syntax breaks fast refresh HOT 2
- Include resources in deps.edn :paths
- $ clj-kondo hook fails to lint & right when component is not a symbol
- The $ macro and new JSX transform HOT 14
- `wrap-fx` is public HOT 1
- Wrappers for useTransition, useDeferredValue, etc. HOT 1
- Is it possible to bypass the camel-casing of properties? HOT 7
- Add wrapper around createRef with atom protocols HOT 2
- How to use with uikit? HOT 2
- Running tests in nodejs with jsdom HOT 4
- Companies using Helix HOT 1
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 helix.