3 ms·
Eliminating Intermediate Array Allocations
- SomaticPirate 2y ago[flagged]
- deleted 2y ago[deleted]
- kragen 2y agothis is a great look at how to poke around under ruby's blankets! i wish it were so ready-to-hand in every environment
- saagarjha 2y agoDoes Ruby not have a way of monkey-patching builtins? Does the compiler check for this?
- hi-v-rocknroll 2y agoAlmost everything in (MRI) Ruby can be modified on-the-fly (which is itself problematic), except compiled-in methods and classes have some (lots) limitations on runtime modification of built-in things. For example, here's one way to instantly break most programs: String.class_eval { undef_method :initialize } While it might be possible with some other hackery to restore this, it's not guaranteed. In general, if you're modifying core Ruby stuff on the fly, it should be done safer on a limited basis with refinements. https://docs.ruby-lang.org/en/2.5.0/syntax/refinements_rdoc.html https://docs.ruby-lang.org/en/2.5.0/syntax/refinements_rdoc....