Re:Strict APIs vs. Forgiving APIs
by masklinn on Wednesday October 28, 2020 @12:47PM
(#24920986)
Because if you want to slice to the end you can just ask for the source's length which is free in most languages (it's not in C or in list-based languages), whereas the "result length" version is either going to have to be computed from the collection length or it's a constraint. In the latter case especially it's annoying to have to do weird computations on the basis of length in order to clamp your existing constraint in case the result would already fit.
[ Parent
| on HN ]
There are no comments on this comment yet.