Expunging `new` from scala 3

It’s an interesting possibility to add new (a, b, c) alongside new { ... }. Btw new { ... } is currently implemented but undocumented, so it might also go away. But there are also downsides.

  • It’s genuinely new syntax, and it would take getting used to. By contrast new { ... } repurposes an existing syntax for structural types with better typing where otherwise you would have got a type error.
  • In the presence of creator applications, it offers a difficult choice: Do you write C(...) or new (...)? I’d argue that C(...) should be preferable since it has more information and is more regular wrt to classes with apply methods. But others might choose new(...), in particular if the class name C is long. So, this would introduce the sort of fruitless tradeoffs that one should avoid in language design. By contrast for new {...} there is no competing alternative syntax.

And abaout the new[C] syntax: I believe that boat has sailed.

1 Like

SIP topic on this: Proposal: Creator applications (going new-less)