

Metaprogramming: Ruby vs. Javascript - drewolson
http://fingernailsinoatmeal.com/post/292301859/metaprogramming-ruby-vs-javascript

======
tumult
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.

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.

Please read the article and think about its quality before voting.

~~~
proemeth
There is no such thing as metaprogramming. To help convince ourselves:
[http://gilesbowkett.blogspot.com/2009/07/do-you-believe-
in-m...](http://gilesbowkett.blogspot.com/2009/07/do-you-believe-in-
magic.html)

~~~
chipsy
The main problem with the term "metaprogramming" is aptly considered here.
"Meta" has been present since programmers started using macroassemblers. We've
just added a lot more techniques since then.

------
iamwil
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.

In addition, there's no way (that I've found) to override the subscript
operator [] in javascript.

~~~
panic
If you think about it, these two complaints are exactly the same.

~~~
iamwil
I guess in javascript, that's true.

------
swannodette
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.

~~~
silentbicycle
Perhaps it would be more accurate to say that "metaprogramming" techniques
have become more integrated into conventional programming in the language?

------
bonquesha99
This project is pretty awesome: <http://jsclass.jcoglan.com/> \- Ruby-style
JavaScript

------
pkulak
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.

