amelentev / java-oo

Java Operator Overloading
http://amelentev.github.io/java-oo/
268 stars 31 forks source link

Assignment operator overloading via constructors #19

Open amelentev opened 10 years ago

amelentev commented 10 years ago

Assignment operator overloading now works only via static valueOf method. In cases we can't add valueOf method to a class we may use constructors: BigDecimal a = "123" will be transformed to BigDecimal a = new BigDecimal("123") (there is no valueOf(String) method in j.m.BigDecimal) But this will add more ambiguity.

binkley commented 10 years ago

I would expect, in general, any of these might work:

Option<T> maybe = T-instance; // assigns Option.of(T-instance) T instance = U-instance; // assigns new T(U-instance)