Can one create Sized Types in Scala?

Posted by Jens Schauder on Stack Overflow See other posts from Stack Overflow or by Jens Schauder
Published on 2010-04-09T17:42:32Z Indexed on 2010/04/09 18:03 UTC
Read the original article Hit count: 230

Filed under:
|

Is it possible to create types like e.g. String(20) in scala?

The aim would be to have compiler checks for things like:

a: String(20) 
b: String(30)
a = b; // throws a compiler exception when no implicit conversion is available
b= a; // works just fine

Note: It doesn't need to be/named String

© Stack Overflow or respective owner

Related posts about scala

Related posts about typesystem