"The tl;dr of the proposed syntax tweak is that, when the compiler already knows unambiguously what type is expected in a location, and you want to refer to a value or method defined in the companion object of that type, you can just prefix that with . instead of spelling out the type name."
"There's a lot more to the proposal - there are a ton of edge cases and details that need to be spelled out in order for it to be a practical enhancement to the language - but the end result is straightforward and intuitive."
"I'd love to see this one go through - it's consistent, easy to teach, and would reduce a pile of annoying everyday boilerplate."
Target-Typed Companion Shorthand is a proposed syntax enhancement for Scala. It allows developers to reference values or methods in a companion object using a dot prefix when the expected type is clear. An example illustrates this with the Shape class, where .Circle and .Red are used instead of explicitly stating the type. The proposal aims to reduce boilerplate code and improve clarity, although it includes various edge cases that need addressing for practical implementation. The community is engaged in discussions about its adoption.
Read at Medium
Unable to calculate read time
Collection
[
|
...
]