Hacker News new | ask | show | jobs
by Floegipoky 1188 days ago
> I want to completely enforce that my record is instantiated with all its invariants dealt with properly

Such validation logic can be enforced in the record's compact constructor.

1 comments

Yes, agreed. But not in a clean "fluent" style. There's something nice about the fluent style that appeals to me (at least).

And I don't like having to provide one constructor for every optional (default) value, when its omitted. There's just not as nice of a style. The "telescoping" constructor pattern is just really hard to use, read and maintain.