Hacker News new | ask | show | jobs
by Buckleyisms 4382 days ago
This is true, and why I also filed bugs asking for a robust reflection and dynamic method compilation. Thankfully, they were duplicates.

But not all of the cases can be accomplished using these techniques, and even those that can, it's often more code.

The ability to reason about which methods are getting called at runtime has been a powerful tool since the beginning of iOS development, and in Mac and NeXTStep development before that. It would be a shame to lose it.

1 comments

monkey patching specifically is pretty heinous in c# but can be done. you should avoid monkey patching in almost any situation though.

one point of yours that i don't understand is the ability to reason about what methods are being called without message passing. if you understand the inheritance hierarchy it should be pretty easy to think about what 'version' of a method is being called? between the known inheritance path and a call stack at runtime this isn't something i find myself missing from obj-c.

where the call stack / inheritance hierarchy does get messy is in calling virtual methods from within constructors, which is a bad practice generally, and something apple devs touch on in the wwdc demos.

Care to share some resources on C#/.net monkey patching? Tia