ciren / cilib

Typesafe, purely functional Computational Intelligence
https://cilib.net
Apache License 2.0
124 stars 101 forks source link

Prevent invalid usages of Objective and Position #287

Closed gpampara closed 6 years ago

gpampara commented 6 years ago

It's possible to allow the user to destructure Position into the constructors. This can cause problems where the needed functions already exist to allow this usage, but in a controlled fashion. Position is a very critical structure, which should always be managed by the Position functions and not changed externally. The fact that a Position transitions between Point and Solution should be irrelevant to the usage. The same can be said for Objective.

Although some of the lenses provided in the library for data access are convenient, they unfortunately provide a loophole with some logic as they are implemented at the moment. For example: it should be impossible to change the objective of a position - but you actually can right now with how the lenses are defined. In some lenses the "setter" portion is simply not valid. Such lenses should be reworked to be Getter instances, or removed.

Furthermore, this scalac bug is extremely troublesome for us.

gpampara commented 6 years ago

The planned changes are currently located within gpampara/cilib@151a93e64