Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What jballanc is saying is that yes these things are possible in Objective-C, but the technique of doing these tricks in Ruby/Motion is an order of magnitude simpler and idiomatic:

    klass = Object.const_set "MySubclass", Class.new(Object)
    
    klass.send(:attr_accessor, :foo)
 
    klass.send(:define_method, "description") {
      "<#{self.class}: foo=#{self.foo}>"
    }


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: