News for hackers. Stuff that matters.
Re:Sublime Text 2 Beta released with Auto-complete and Impro... by rorrr on Thursday January 12, 2012 @03:05AM (#3455486)
That's such an edge case. I've never seen anybody defining functions in evals, especially as concatenated strings.
Re:Sublime Text 2 Beta released with Auto-complete and Impro... by TylerE on Thursday January 12, 2012 @01:06PM (#3457315)
I've done it.

Use case involves a class wrapping python's xml-rpc stuff to talk to Drupal.

Drupal's xml-rpc interface is not the most pleasant thing to work with, as you have to pass in a session id and auth token on every request, and then all the "actual" parameters go in as an array.

My wrapper class would query the remote interface for available methods, and then dynamically generate, via eval, a function object that used a closure to store the sess/auth tokens, and that took a variable number of arguments to pass as the 3rd array argument to the function. The eval'd function object was then bound as a method to the connection object.

It also did a bit more magic, such as on error logging the arguments to a file. ALl in all it made writing web-service clients a lot more pleasant.

Re:Sublime Text 2 Beta released with Auto-complete and Impro... by agento on Thursday January 12, 2012 @03:40AM (#3455566)
Maybe you should take a look at the Rails sourcecode.
Re:Sublime Text 2 Beta released with Auto-complete and Impro... by FooBarWidget on Thursday January 12, 2012 @08:35AM (#3456234)
Rails only does that to optimize certain function calls. eval() is used as a method to compile/inline certain functions. Most code in Rails does not use eval.
Re:Sublime Text 2 Beta released with Auto-complete and Impro... by drothlis on Friday January 13, 2012 @02:03AM (#3459514)
https://github.com/rails/rails/blob/2-3-stable/actionpack/li...

Try getting your editor to find that definition of method "accept_language" or "cache_control". :-)