Re:Parse, Don't Validate (2019)
by asimpletune on Tuesday March 07, 2023 @10:10AM
(#35056161)
Just wanted to add that in some languages you could have a makePrime function that takes an int and returns a maybe[Prime]. If you don't make the constructor public this works perfect, as there is essentially no way to get a Prime without going through the pathways that library author relies upon. This is a pattern that's used in Scala a lot anyways.
[ Parent
| on HN ]
There are no comments on this comment yet.