TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ijk – Transforms arrays into virtual DOM trees

59 点作者 lukejacksonn超过 7 年前

15 条评论

always_good超过 7 年前
What makes Hiccup so nice in the Clojure world is that Paredit can be used here which is the tool you&#x27;re already using to manipulate data structures.<p>For example, with Paredit, you can create an element and then move it prev&#x2F;next&#x2F;up&#x2F;down a tree with muscle memory you&#x27;re already using for the rest of your code.<p>When I re-entered the Javascript world, I tried arrays-for-html but realized it&#x27;s unbearable without manipulation tooling. I think something like JSX makes more sense at that point since I find you&#x27;re more likely to already be using an HTML manipulation tool like Emmet which is more pleasant than hand-editing array structures.
评论 #16213887 未加载
wrren超过 7 年前
I like the syntax, but I have to say that I prefer JSX. The real advantage of JSX is that it&#x27;s very similar to HTML and developers have been reading, mentally modeling and reasoning about HTML -&gt; DOM translation for decades.
评论 #16212887 未加载
评论 #16212857 未加载
评论 #16213915 未加载
评论 #16212898 未加载
aaron-lebo超过 7 年前
Reminiscent of Breve.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;cwells&#x2F;breve" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;cwells&#x2F;breve</a><p>I don&#x27;t see a huge advantage over hyperscript (hyperapp and mithril both use it), but that <i>is</i> a ridiculously small codebase.<p>The JS hate is kind of funny around here, because when you dig into stuff like this, you realize that JS is very lispy in ways (it&#x27;s easy to build up trees of HTML dynamically). In the mid aughts on r&#x2F;programming people would rant and rave about the kind of stuff Smalltalk&#x27;s Seaside could do. Now that&#x27;s possible, most of the disadvantages have been worked out, and people hate it.<p>Can&#x27;t win, can you?
评论 #16212800 未加载
评论 #16213495 未加载
评论 #16213816 未加载
评论 #16212775 未加载
评论 #16212943 未加载
adius超过 7 年前
This synatx is called JsonML and I&#x27;m maintaining a stable and highly usable implementation: <a href="http:&#x2F;&#x2F;adriansieber.com&#x2F;shaven" rel="nofollow">http:&#x2F;&#x2F;adriansieber.com&#x2F;shaven</a>
评论 #16213167 未加载
chadhietala1超过 7 年前
The Glimmer VM uses an IR that looks very similar to this and based on the same premise, code as data. <a href="https:&#x2F;&#x2F;engineering.linkedin.com&#x2F;blog&#x2F;2017&#x2F;03&#x2F;glimmer--blazing-fast-rendering-for-ember-js--part-1" rel="nofollow">https:&#x2F;&#x2F;engineering.linkedin.com&#x2F;blog&#x2F;2017&#x2F;03&#x2F;glimmer--blazi...</a>.
athenot超过 7 年前
I guess it would be useful for programmatically building the DOM tree. But for writing DOM fragments, pug[1] is also an option. I happen to like the clean-looking syntax. Transposing their example:<p><pre><code> body h1 Hello World input(type=&#x27;range&#x27;) input(onclick=&#x27;console.log&#x27;) Log event ul li 1 li 2 li 3 unless false span Hidden </code></pre> [1] <a href="https:&#x2F;&#x2F;pugjs.org&#x2F;api&#x2F;getting-started.html" rel="nofollow">https:&#x2F;&#x2F;pugjs.org&#x2F;api&#x2F;getting-started.html</a>
评论 #16214857 未加载
sendben2超过 7 年前
Terse is definitely the right word.
undecisive超过 7 年前
Interesting approach. I did something similar a while back, took a more function-based approach: <a href="https:&#x2F;&#x2F;github.com&#x2F;undecided&#x2F;tg" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;undecided&#x2F;tg</a><p>At that point, I hadn&#x27;t really done much react-style apps - will have to see how well that works with React!
评论 #16212892 未加载
k__超过 7 年前
Also <a href="https:&#x2F;&#x2F;github.com&#x2F;Jador&#x2F;react-hyperscript-helpers&#x2F;blob&#x2F;master&#x2F;README.md" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Jador&#x2F;react-hyperscript-helpers&#x2F;blob&#x2F;mast...</a><p>which is even more terse
评论 #16213200 未加载
lewis500超过 7 年前
Looks awesome. Makes me wish I still used LiveScript because of the \string syntax and other features that would go great with ijk.<p>You refer to h but what is it? I searched around but obviously something called h is hard to find.
评论 #16213516 未加载
评论 #16213368 未加载
评论 #16213355 未加载
ricardobeat超过 7 年前
2010 strongly echoes in my head: <a href="https:&#x2F;&#x2F;github.com&#x2F;jed&#x2F;fab" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;jed&#x2F;fab</a>
gliechtenstein超过 7 年前
You guys should check out <a href="https:&#x2F;&#x2F;www.celljs.org" rel="nofollow">https:&#x2F;&#x2F;www.celljs.org</a> if you like this type of approach
baq超过 7 年前
nevow.stan did that back in 2004 :)<p><a href="https:&#x2F;&#x2F;github.com&#x2F;twisted&#x2F;nevow&#x2F;blob&#x2F;master&#x2F;nevow&#x2F;stan.py" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;twisted&#x2F;nevow&#x2F;blob&#x2F;master&#x2F;nevow&#x2F;stan.py</a>
评论 #16213799 未加载
ivanceras超过 7 年前
Improve it a little bit more by by removing the single quote by turning the html tags into functions that accepts 2 arrays: the attributes and the child elements, by this time you will come across with elm in which expressing the html document tree fits perfectly in the language syntax and semantics.
评论 #16212906 未加载
评论 #16212814 未加载
xori超过 7 年前
Love it, I see this replacing my express templates. Well done.