"Model 2" prototype status

Rémi Forax forax at univ-mlv.fr
Thu Aug 6 20:30:51 UTC 2015



Le 6 août 2015 18:56:35 CEST, Simon Ochsenreither <simon at ochsenreither.de> a écrit :
>I'm not saying that duplicating static members is without benefits,
>especially
>when it comes to ease of implementation.
> 
>The problem with this approach is that it vastly complicates the mental
>model of
>everyone learning or using Java.
>Today, people have to distinguish between members which are per-class
>and
>members which are per-instance.
> 
>(Java doesn't separate these members, but allows mixing them freely at
>declaration site. From my experience with beginners learning to
>program, this is
>pretty bad already.)

yes, it's bad and an usual issue unless you introduce static after 5 or 6 weeks courses.

but accessing to a field or a local variable with the same syntax is far worth IMO.

> 
>With duplicated members, we would put the implementation details of
>specialized
>classes right in front of users, and force them to learn another layer.
>We would have
>- members per class without class-level Generics or with erased
>Generics
>- members per specialized class artifact of a class with reified
>Generics
>- members per instance
> 
>This is especially confusing given that the duplicated fields would
>only exist
>for value types, while reference types would share the same member.
> 
>I've spent a lot of time in Scala working to remove things where people
>said
>"oh, you just need to spend 5 minutes learning it, and then it will be
>fine!".
>Duplicated statics is certainly not a 5 minute tax on every present or
>future
>Java developer, it's probably a magnitude more.

Rémi 




More information about the valhalla-dev mailing list