4 ms·
Wouldn't the challenge in ruby be the prevalence of things you just can't and don't do in PHP? Thinks like instance_eval, class_eval, etc....in Ruby projects I'
by rufugee 17y ago
Wouldn't the challenge in ruby be the prevalence of things you just can't and don't do in PHP? Thinks like instance_eval, class_eval, etc....in Ruby projects I've worked on (and especially in Rails), these are all over the place.
Of course, assuming these calls all happen on the front end (source load) and not downstream in response to some triggering event, your approach would probably work.
- raganwald 17y ago`instance_eval` and `class_eval` are very hairy if you pass strings (which you MUST do for some kinds of template metaprogramming). But they aren't hairy at all if you pass blocks, where all you are doing is (essentially) setting `this`.