3 ms·
> clashing classes not being an error You’re probably talking about the ability to reopen (or “monkey patch”) classes (which is why defining the same class aga
by Toutouxc 2y ago
> clashing classes not being an error
You’re probably talking about the ability to reopen (or “monkey patch”) classes (which is why defining the same class again can’t be an error). That’s a powerful tool if you use it carefully, especially for debugging or hacking on someone else’s code.
> blocks feel like a more cumbersome/limited version of lambdas
Yes, that’s basically what they are. You could totally write JS-like code and pass even multiple lambdas to methods. However, the most common use case — passing a single important lambda (e.g. to a “map” or “each” method) — gets special treatment and its own language feature.
> what's the magic everybody loves
For me it’s the “batteries included” factor. Ruby can do a lot out of the box and most of the interfaces are well designed with tons of useful methods with descriptive names. It feels like someone cares about my experience and is trying to anticipate what I might actually need.
Also the object oriented mechanisms are easy to understand and don’t feel weirdly bolted on like in Python.
- strken 2y agoReopening classes is a powerful tool, but it would be a lot safer if the syntax was limited to class_eval and didn't let you define the same class twice.