There are interesting discussion:
-Better number literals (Better number literals)
-Bigdecimal literal (Bigdecimal literal)
We also widely use custom types in our framework (to provide 3vl for better database integration):
-date
-Number
-String
The best way to construct these types is string interpolation.
I agree that:
I think, if there is the ability to use string interpolation in pattern matching the most difficulties will be solved.
If support for “unapply” is implemented:
implicit class ExtendedLongHelper(val sc: StringContext) extends AnyVal {
def el(args: Any*): Long = ???
def unapply(args: Any*):Boolean = ???
}
There will be ability to write:
val l = el”1000_4332_24”
l match {
case el”1000_4332_24” => println( “good :)” )
}