How to compare Scala function values for equality

前端 未结 2 1608
面向向阳花
面向向阳花 2020-12-06 17:21

How can you compare two Scala function values for equality. The use case is that I have a list of functions where the list can contain duplicates and I only want to execute

2条回答
  •  太阳男子
    2020-12-06 17:48

    Short answer: It's not possible.

    Longer answer: You could have some kind of function factory that ensures that "identical" functions are acutally the same object. Depending on the architecture of your application, that might not be feasible though.

提交回复
热议问题