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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Metaprogramming: Ruby vs. Javascript

38 点作者 drewolson超过 15 年前

5 条评论

tumult超过 15 年前
There is no metaprogramming going on in the JavaScript here. Closures are not metaprogramming. It's just programming. I do not want to call names, but the author does not know what he is talking about.<p>Metaprogramming inside of a running JS system would involve eval() and generating JS code from strings, which you don't want to do. It's prone to exploding in your face and the performance profile is terrible.<p>Please read the article and think about its quality before voting.
评论 #1047984 未加载
评论 #1047657 未加载
评论 #1047668 未加载
评论 #1047714 未加载
评论 #1047808 未加载
评论 #1051554 未加载
评论 #1047816 未加载
iamwil超过 15 年前
One difference I found is that Javascript has no "method_missing" call. Firefox is ahead of the pack here, as it implements a non-standard __noSuchMethod__ call, but that doesn't exist in the latest chrome or safari.<p>In addition, there's no way (that I've found) to override the subscript operator [] in javascript.
评论 #1048082 未加载
评论 #1047861 未加载
swannodette超过 15 年前
Wow, who would have thought this article would have started such a contentious thread. An interesting point is that more powerful languages blur the distinction between programming and meta-programming, weaker languages make the distinction more clear.
评论 #1048297 未加载
bonquesha99超过 15 年前
This project is pretty awesome: <a href="http://jsclass.jcoglan.com/" rel="nofollow">http://jsclass.jcoglan.com/</a> - Ruby-style JavaScript
pkulak超过 15 年前
I had no idea that you could define a method on a single instance with access to the current scope. I used to always call instance_variable_set before def to get the data I needed in there.