Towards Minimal L World

Brian Goetz brian.goetz at oracle.com
Sun May 20 16:44:21 UTC 2018


Yes, this would work as a hack — implicitly declare a private ctor that initializes the fields only, and let users write factories that do validation / normalization.  The hacky part is that there has to be an order of the fields, and we’d probably take the order in which the fields are declared in the source file, which is kind of brittle.  So I’d say that this definitely goes in the “expedient MLW tricks” category, rather than a viable user model for LW10.  


> On May 19, 2018, at 9:31 AM, Dan Smith <daniel.smith at oracle.com> wrote:
> 
>> On May 18, 2018, at 2:05 PM, Brian Goetz <brian.goetz at oracle.com> wrote:
>> 
>> 
>>> Thesis:  Value constructors are the same notation as VBC constructors.
>> 
>> +1.  I don't think its a good use of our "user model complexity budget" to have a different way to write these guys.  It also facilitates migration.  And "Codes like a class" has a pretty sensible answer for "how do I write a constructor."
> 
> A simpler approach, in the spirit of "let's not waste effort on problems we don't know how we're going to solve": you get one implicit constructor, and it's private. You can't declare custom constructors. Write factory methods for your clients.



More information about the valhalla-spec-experts mailing list