Re: Builder: Tiny Utility Library to Add a Builder API to Classes

2023-01-06 Thread thebluepandabear via Digitalmars-d-announce
On Friday, 6 January 2023 at 12:54:07 UTC, Vijay Nayar wrote: On Friday, 6 January 2023 at 09:26:51 UTC, thebluepandabear wrote: .isActive(true) .build(); ``` Good  how would I extend the builder methods? The builder methods are automatically generated and go up the inheritance chain

Re: Builder: Tiny Utility Library to Add a Builder API to Classes

2023-01-06 Thread Vijay Nayar via Digitalmars-d-announce
On Friday, 6 January 2023 at 09:26:51 UTC, thebluepandabear wrote: .isActive(true) .build(); ``` Good  how would I extend the builder methods? The builder methods are automatically generated and go up the inheritance chain to capture all the fields in your class. (I assume that you

Re: Builder: Tiny Utility Library to Add a Builder API to Classes

2023-01-06 Thread thebluepandabear via Digitalmars-d-announce
.isActive(true) .build(); ``` Good  how would I extend the builder methods?

Re: Builder: Tiny Utility Library to Add a Builder API to Classes

2023-01-06 Thread Vijay Nayar via Digitalmars-d-announce
On Thursday, 5 January 2023 at 23:31:36 UTC, Vladimir Marchevsky wrote: On Thursday, 5 January 2023 at 21:48:40 UTC, Vijay Nayar wrote: 2. Using a constructor with many arguments. ``` A a = new A("Bob", 20, false, true); ``` This approach can construct arguments inline, such as during a

Re: Builder: Tiny Utility Library to Add a Builder API to Classes

2023-01-05 Thread Vladimir Marchevsky via Digitalmars-d-announce
On Thursday, 5 January 2023 at 21:48:40 UTC, Vijay Nayar wrote: 2. Using a constructor with many arguments. ``` A a = new A("Bob", 20, false, true); ``` This approach can construct arguments inline, such as during a function call, however, the arguments are not labeled, making it easy to get

Builder: Tiny Utility Library to Add a Builder API to Classes

2023-01-05 Thread Vijay Nayar via Digitalmars-d-announce
https://code.dlang.org/packages/builder Interacting with many projects that are related to Java, I could not help notice that a common "Builder API" is not easily available in D. What is the problem? When constructing classes, especially those with lots of data, there are two broad ways of