Why were the case classes without a parameter list deprecated?

后端 未结 2 637
甜味超标
甜味超标 2020-12-05 04:37

Why were the case classes without a parameter list deprecated from Scala? And why does compiler suggest to use () as parameter list instead?

EDI

2条回答
  •  情歌与酒
    2020-12-05 04:55

    Without parameters, every instance of the case class is indistinguishable and hence is essentially a constant. Use an object for that case.

提交回复
热议问题