TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Metaprogramming: Ruby vs. Javascript

38 pointsby drewolsonover 15 years ago

5 comments

tumultover 15 years ago
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 未加载
iamwilover 15 years ago
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 未加载
swannodetteover 15 years ago
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 未加载
bonquesha99over 15 years ago
This project is pretty awesome: <a href="http://jsclass.jcoglan.com/" rel="nofollow">http://jsclass.jcoglan.com/</a> - Ruby-style JavaScript
pkulakover 15 years ago
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.