News for hackers. Stuff that matters.
Re:Applying “make invalid states unrepresentable” by wa1987 on Monday October 05, 2020 @05:03AM (#24685874)
Related video on this subject: https://www.youtube.com/watch?v=IcgmSRJHu_8
Re:Applying “make invalid states unrepresentable” by matsemann on Monday October 05, 2020 @05:58AM (#24686160)
I thought about that video today when integrating with an old SOAP API. I need to find the name+some property of some persons. Instead of having a list with [(name1, prop1), (name2, prop2),...], I get two distinct lists of [name1, name2,..] and [prop1, prop2,..]. In practice I think the lists will always match. But there is nothing stopping them from not being the same length, or even worse: one having a gap..
Re:Applying “make invalid states unrepresentable” by vbezhenar on Monday October 05, 2020 @06:24AM (#24686299)
Put an assertion. It's better to throw early rather than dealing with wrong data later.