|
|
|
|
|
by brabel
1648 days ago
|
|
> Rails prides itself on being able to write `5.minutes` - they monkey patch numbers to add a minutes function. That can be done in strongly, statically typed languages with either extension functions (Kotlin, Dart) or type classes (Rust, Haskell). People do it because there are advantages beyond the subjective reason that it reads better (I can speak several human languages and in all of them you would say number-timeUnit - so it's not just English even if it's not completely universal). It's also easier to "look up" functions based on the type of the value, for example. |
|