programming language: ruby
DESCRIPTION
Programming Language: RubyTRANSCRIPT
1993
1995
1999
2003
2004
2005
2010
(http://jruby.codehaus.org/)JVM)
(http://www.ironruby.net/)
…●
○○○
●
- BINDING:
def binding_elsewherex = 20return binding
end
remote_binding = binding_elsewherex = 10eval("puts x")
eval("puts x", remote_binding)
Reflection:
class Personend
def add_accessor_to_person(accessor_name)Person.class_eval %Q{
attr_accessor :#{accessor_name}}
end
irb>> person = Person.newirb>> add_accessor_to_person :nameirb>> add_accessor_to_person :genderirb>> person.name = "Peter Cooper"irb>> person.gender = "male"irb>> puts "#{person.name} is #{person.gender}"---------------------------------------------
class MyClassdef initialize
@my_variable = 'Hello, world!'end
endobj = MyClass.newobj.instance_eval { puts @my_variable }
-Efficiency ?
- Isn’t widely used in Industry except for web apps
- Not Powerful as python ( Not biased :P )