5 ms·
Really? This is just a standard printf-style format string, something which all programmers should be familiar with. Even the '%' syntax isn't unique to Ruby; P
by lonestar 17y ago
Really? This is just a standard printf-style format string, something which all programmers should be familiar with. Even the '%' syntax isn't unique to Ruby; Python uses it as well IIRC.
- axod 17y agoThe formatting string itself, sure - fine. What I think is ugly is using an operator (%) to call a function like that :/ It's just non-obvious and quirky. If you don't know ruby you won't be able to guess what it's doing.
- natrius 17y agoThe best solution here is probably to learn Ruby. There are plenty of non-obvious things in various programming languages. The benchmark should be readability by people who know the language.
- axod 17y agoI disagree. Most languages you can take a guess at without learning them. It's horrible things like this operator that will catch people out.
- Andys 17y agoI guess that any seasoned programmer would be well-aware of the printf notation (%.2f) and would immediately guess that % must be a printf operator in this language. I love using printf all the time in my programs and it is one of my litmus tests for a new language - does it have easy quick access to sprintf? (Java failed this test)