4 ms·
What does Ruby have to do with any of this?
by anamoulous 10y ago
What does Ruby have to do with any of this?
- goatlover 10y agoLike PHP and JS's template literals, it has full on string interpolation.
- anamoulous 10y agoArguably Ruby is worse because you can execute instance methods in interpolation, but I still don't see why that's germane to this discussion other than to pick a fight about languages.
- smitherfield 10y agoRuby string interpolation can only happen in literal source code, not in user input. 2.4.0 :001 > a = 5 => 5 2.4.0 :002 > gets.chomp #{a} => "\#{a}"
- Manishearth 10y agoThese are only in literals, however. You cannot have a string value with interpolation exprs inside it (both in JS and Ruby)
- jsjohnst 10y agoGuys, this has nothing to do with interpolation. I like both Python and Ruby's string interpolation. I'm replying to the incredulous parent of my post who's griping about magic methods (which admittedly Ruby likely takes the crown).
- jsjohnst 10y agoSee the parent comment I'm replying too. Parent is ridiculing Python "magic methods". If he thinks they are bad, just wait till he sees Ruby.