From jackammo77 at gmail.com Wed Jul 29 05:02:02 2020 From: jackammo77 at gmail.com (Jack Ammo) Date: Wed, 29 Jul 2020 01:02:02 -0400 Subject: no good default issue Message-ID: feel free to disregard if this doesn't make sense, but i wonder if the definitely unassigned / definitely assigned rules coupled with an explicit opt in default could help the situation. if we know that a field has not been explicitly assigned, can there be a quick check if the class opts in to a default factory (a no arg constructor perhaps?) and then takes the slower path of calling that factory? or maybe upon accessing a definitely unassigned field, do the check and call the default factory? i don't know how expensive it would be to keep track of that, but if the opt in is a no arg constructor then there can be enough restrictions in place to only allow either throwing an exception or pass relevant defaults to the full all arg constructor. and if you're willing to go the default no arg constructor route, than i also have another idea for array initialization... what if you can define a default "array initializer" (it can sorta look like a constructor if you squint your eyes just right) except it takes in an array with definitely unassigned elements of the value type and must return an array with definitely assigned elements or throw an exception. and than that class opts in to a slower path for arrays created with the default value. just my 2 cents. -Jack