Hacker News new | past | comments | ask | show | jobs | submit login

It's a convenience method for a specific case where the result is already obvious, because it's called on a string literal that already looks like a regex. Any competent Scala dev reviewer would reject code that uses the "r" method on a variable.

If you want a more verbose option, you can import the Regex type and write:

    val date = Regex(raw"(\d{4})-(\d{2})-(\d{2})")
And of course, explicit type declarations can further document the code.



> Any competent Scala dev reviewer would reject code that uses the "r" method on a variable.

Boy do I have news for you




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: