News for hackers. Stuff that matters.
Re:Representing State as Interfaces in Go by iainmerrick on Thursday March 28, 2024 @04:33PM (#39856976)
Isn’t the point of the builder pattern to separate the builder object (which is mutable) from the final built object (which can be immutable)?

That seems like the same thing as the example in the original post.

Re:Representing State as Interfaces in Go by ReleaseCandidat on Thursday March 28, 2024 @05:03PM (#39857289)
For me a "builder pattern" is also something like this with immutable data:

   built = empty().configA(a).configB(b). ... .configZ(z)
  
where each

   config?(this : T, k : K) -> T
For me the defining feature of a builder is the (possibility of a) gradual "configuration" (or whatever) of the data structure being "built". A state change is something else in my opinion, but of course, the difference between a "state change" and a "configuration" (which does change state) isn't a clear one, so if for you that is still a builder, that's fine for me too ;).