-
Notifications
You must be signed in to change notification settings - Fork 51
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
Hiccup #32
Comments
Hiccup is our # 1 requested feature and we understand that lightweight syntax is important, especially for css-heavy views. We will add hiccup, or something like it, eventually. in the meantime we haven’t actually figured out a great way to do it that doesn’t damage electric’s value prop in other ways. We are confident that this can be done. However, Electric functions are more powerful than Reagent components (for example Reagent components return virtual dom but Electric functions return reactive values), so the idioms are different and there are more edge cases. So the Reagent-style syntax doesn't necessarily map 1:1 here. We've POC'ed hiccup syntax twice (and at least one external user contributed an attempt). All attempts to date have ambiguous edge cases which cause problems in more complex compositions. And we can't yet forsee all the patterns Electric-dom needs to support. Our approach right now is to prioritize correct unambiguous semantics over syntax, until the large scale idioms are clear and fully understood. The current syntax, while low-level, is 100% unambiguous and semantically precise. Once we are satisfied with the max-expressive-power patterns needed for complex apps, we will use that as a starting point for determining a lightweight syntax frontend. |
Hiccup might be a force of habit after all. The more I use electric's syntax the more I find that it is actually more powerful and less of a headache than hiccup. Hiccup might be great for serialization (which doesn't make much sense in electric's case anyway). The only thing I'm looking forward to is more brevity but all the above makes sense; the foundation needs to be robust. Since a lot of people have written a considerable amount of code in electric's current syntax, maybe it would be worthwhile to consider a code-rewriting tool in the future? Could also be a community effort. The highest friction I've experienced with electric as an early adopter has been rewriting between |
bonus: it could be used on all existing electric examples |
List of hiccup integration attempts (or other non-hiccup sugar over electric): |
List of problem statements: markup-heavy apps
familiarity
data-oriented programming
|
Quotes from people who changed their mind:
|
FWIW, I don't have a preference for one over the other. For me, Hiccup is surface-level stuff, and semantics and performance matter more. But I've been through UIx and Fulcro as well, who have chosen to stay away from Hiccup because of performance and other reasons. I remember Roman quoting that Hiccup parsing was a significant percentage of each rendering cycle at Pitch, before they moved to UIx. |
My issue with the current dom API is not the "syntax" per say, I don't have a preference over hiccup or sexprs. It's the effectful evaluation that bothers me. Evaluating This leads to a whole lote unintuitive, unclojure-like API that I grew to like. This became very apparent to me when i tried creating reusable components and i wanted to have "higher-ordered" components, and the evaluation model caught me by surprise. https://clojurians.slack.com/archives/C7Q9GSHFV/p1715512802650349 I'm sure the more I use it the more used to it i'll get, but I'm also sure there'll be some other corner cases where the said effectful-ness will bite me in the a. |
An update on this comment: https://clojurians.slack.com/archives/C7Q9GSHFV/p1716072530502729 TL;DR I grew quite fond of the current DOM API that |
The https://github.com/luchiniatwork/hiccup-for-electric proposal is the functionality I'd like to see - from my novice perspective. Any informed comments on this? |
Closing as I opened the issue and came to the conclusion hiccup would be a limiting force in electric as described here |
I've had a go at writing a fairly simple macro that allow hiccup and electric dom calls to be mixed without any apparent limitations. Ok its not pure hiccup but It is certainly vastly simplifying the examples I have. |
I've created a library that provides hiccup-like syntactic sugar for Electric V2. This can be intermingled with regular electric syntax. |
Here hiccup is transformed into react elements statically at macroexpansion time and otherwise at runtime. For the runtime case it should be easy to swap react for electric-dom2 calls but I'm not sure how reactive updates would work.
What's the current thinking on challenges to support hiccup for DOM generation?
The text was updated successfully, but these errors were encountered: