在服务器端和客户端使用 clojurescript 构建网站
我正在考虑使用 ClojureScript 构建一个网站。在客户端和服务器端都编写 ClojureScript 是否有意义,就像 Node.js 一样?
I am considering building a website using ClojureScript. Does it make sense to write ClojureScript on both the client side and the serverside, much like node.js?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是可能的,但绝对没有理由不在服务器端使用 Clojure 本身,并且您将获得更好的性能和更好的库可用性。 Clojurescript/Clojurescript 的接口并不比 Clojure/Clojurescript 更容易。
我建议这样做的唯一情况是,您已经完全致力于服务器端 javascript 基础设施(例如,节点)并且想要编写 Clojurescript 而不是 Javascript。
It's possible, but there's absolutely no reason not to use Clojure itself on the server side, and you'll get better performance and much better library availability. Interfacing Clojurescript/Clojurescript is no easier than Clojure/Clojurescript.
The only situation where I'd recommend this is where you're already fully committed to a server-side javascript infrastructure (e.g, node) and wanted to write Clojurescript instead of Javascript.
JVM 和并发参数似乎很重要。并且 clojure/clojurescript 非常相似,因此在客户端和服务器中使用相同语言的参数在这里似乎并不重要。
对于服务器(nodejs)上的 clojurescript,我们有这个 MACCHIATO 它类似于环。
The JVM and concurency argument seems important.And clojure/clojurescript are very similar so the argument to use same language in client and server doesnt seem important here.
For clojurescript on the server(nodejs) we have this MACCHIATO its similar to ring.
@对 Levand 的回复:(不是真正的答案,我只是一个普通人,主要是 php 程序员)。所以。我真的(如果可以的话)敦促莱万德进一步发展他的答案。只是不明白,仅此而已。我非常喜欢 Lisp 的一些特性(特别是计划中相当不寻常的宏语法)。因此,我希望他(如果他知道的话)或任何其他人告诉我这件事。有什么不好的呢。我根本不认为有什么不好。相反,我更喜欢它(不幸的是我自己没有在浏览器中使用 clojurescript)。我脑子里唯一能想到的坏事就是。
如果 Gambit-Scheme 对于 unix 脚本编写者来说是一个很好的工具,那么我看不出在浏览器或服务器中使用一些不错的 Clojurescript Lisp 会出现什么问题。 (正如你所看到的,我很难称自己为一个优秀程序员。我全职使用了 Debian 两个月,然后向自己保证 Debian 和 Ubuntu 不适合我,尽管它并不算坏。只是感觉它让我想要简单的事情变得复杂了)。如果不是为了学习和实验的乐趣。 (尝试从新的方向看待问题,或者说“跳出框框思考”)。如果 Zubair 能够分享他对将 clojurescript 集成到 html 的想法我会非常高兴。 /糟糕的程序员在学校里被另一个糟糕的程序员欺骗了,并且很高兴他学会了它。虽然这是一次相当令人沮丧的经历。 将球扔到空中,希望有人能捡起来。
@A reply to Levand: (Not a real answer and I am just a plain human being who is mainly a php programmer). So. I really really (if you can) urge levand to futher develop his answer. Just don't get it, thats all. I am a big fan of some lisp features (especially a rather unusual macro syntax in scheme). Therefore I would like him (if he knows it), or anybody else for that matter to tell me. Whats so bad about it. I don't see anything bad at all. On the contrary I rather like it (havn't used clojurescript in the browser myself unfortunately). The only bad thing I can think of on the top of my head is.
If Gambit-Scheme can be a good tool for a unix scripter then I can't see what the problem is with having some nice Clojurescript Lisp in the brower or server. (As you can see I can hardly call myself a good programmer. F.e. I used Debian full time for 2 months then promised myself that Debian and Ubuntu was not for me, although it hardly was bad or so. Just the feeling that it complicated things that I wanted to be easy). If not so for the fun of learning and experimenting. (Tries to see the problem in a new direction, or so to say, "thinking outside the box"). If Zubair could share his thoughts on the matter of integrating clojurescript in html I would be more than happy. /Bad programmer who was tought scheme in school by another bad programmer and is very happy he learned it. Although it was a rather frustrating experiance. Throws the ball away in the air, hoping that someone can take it up.