Re:The Case Against OOP Is Wildly Overstated
by nostrademons on Saturday August 01, 2020 @02:36AM
(#24018222)
You can do this, but unless all the intermediate types are auto-generated by the compiler, it's going to be a lot of typing (of the keyboard type). Many structs that require multi-pass initialization have many, many fields. Each field that isn't late-initialized is going to be duplicated for each following pass. That's the type of maintenance headache that compilers are meant for.
[ Parent
| on HN ]
Re:The Case Against OOP Is Wildly Overstated
by lmm on Saturday August 01, 2020 @04:04AM
(#24018661)
If you have higher-kinded types and a working record system you can do it by transforming your existing types. Even in more limited languages you might be able to make it manageable with phantom types, e.g. Java's "type-safe builder pattern".