Re: Anonymous value class ?

2018-07-11 Thread Brian Goetz
Seems a possibility.   Let’s put this on the list, but right now we’re focusing 
on getting to a usable minimal implementation so we can gather usability and 
performance feedback.   Language work to follow!  

> On Jul 11, 2018, at 11:57 AM, Remi Forax  wrote:
> 
> While testing how value types can be used, i had to find workarounds around 
> the fact that there is no way to create an anonymous value class using the 
> compiler.
> 
> If we follow the idea of having a classical constructor being transformed to 
> a factory method, i think we should also allow anonymous value class.
>  new __ByValue Object() {
>   ...
>  };
> a synthetic factory $make$ being generated instead of a synthetic 
> constructor. 
> 
> Rémi



Anonymous value class ?

2018-07-11 Thread Remi Forax
While testing how value types can be used, i had to find workarounds around the 
fact that there is no way to create an anonymous value class using the compiler.

If we follow the idea of having a classical constructor being transformed to a 
factory method, i think we should also allow anonymous value class.
  new __ByValue Object() {
   ...
  };
a synthetic factory $make$ being generated instead of a synthetic constructor. 

Rémi