by chriswarbo · 5y ago · 0 comments
Since then I've defined a .has method which requires the argument to have the same type as the collection, which completely avoids such problems.
My `.has` method uses cats.Eq and is monkey-patched on to the Iterable interface:
implicit final class IOps[A: cats.Eq](val i: Iterable[A]) {
def has(x: A): Boolean = i.exists(_.eqv(x))
}Yet not the most important static analysis suite, which is included in the compiler, and enforced on all code: the type checker ;)
This sounds like you're not programming in the Java language, you're programming in some sort of graphical macro language which compiles down to Java (presumably built-in to an IDE of some sort?).
The fact that people resort to such things is evidence that this is a valid criticism of the Java language.