golem icon indicating copy to clipboard operation
golem copied to clipboard

Auto constructor for structs

Open fogfish opened this issue 1 year ago • 0 comments

As a Engineer I want to automate simple constructors so that allocation of new type is an "arrow function: (A, B, C) => T" eliminates the boilerplate

type T struct {
  a A
  b B
  c C
}

var NewT = hseq.Arrow3[T, A, B, C]

As hypothesis we eliminate boilerplate:

func NewT(a A, b B, c C) *T {
  return &T{a:a, b:b, c:c)
}

fogfish avatar Jan 26 '25 10:01 fogfish