a thoughtful web.
Good ideas and conversation. No ads, no tracking.   Login or Take a Tour!
comment by Orth
Orth  ·  3473 days ago  ·  link  ·    ·  parent  ·  post: Dynamically Declaring Functions and Methods

I haven't used Ruby for much, but from what I remember learning it, it has the ability to do what you want. Found an article on it. Reading that article, it gives a VERY basic example. A search for "dynamic methods ruby" gets a lot of results.





rob05c  ·  3473 days ago  ·  link  ·  

It can. Any homoiconic language can. Or in other words, any language with 'eval.' Ruby, Python, Javascript, Lua, Bash—almost every scripting language. But you should be very, very careful with eval ('loadstring' in Lua). Evaluating arbitrary text as code is a huge attack vector. That's why I recommended embedding a scripting language, where you can easily lock it down.