epfl-lara / ScalaZ3

DSL in Scala for Constraint Solving with Z3 SMT Solver
Apache License 2.0
121 stars 33 forks source link

Implement `*ValHandler.convert(...)` directly in `ValHandler` #53

Closed ptitjes closed 7 years ago

ptitjes commented 7 years ago

It seems to me that implementing convert(...) in every ValHandler subclasses defeats the purpose of the Default type-class.

I'm willing to make a PR for this.

samarion commented 7 years ago

I think Default and convert(...) are somewhat different (see Philippe's comments in ValHandler.scala on why). However, I think we could indeed replace convert by something that returns an option and use the defaultValue as a getOrElse to reduce duplication.

Please open a PR if you want this changed :)

ptitjes commented 7 years ago

Well, I tried to implement it without success. Scala's implicit handling impose that the implicit resolution of the converter occurs where the type is fully know (hence in ValHandler's subclass...). Closing.