3 ms·
> How the hell does this work? It's easy, since it works as it always did. You check whether the list coming from the database has the correct size n, and then
by jules 11y ago
> How the hell does this work?
It's easy, since it works as it always did. You check whether the list coming from the database has the correct size n, and then the type system knows that and lets you pass said list to a function that expects a list of size n.
list = GetAListFromTheDatabase()
if(list.size == n){
// type checker knows that the size is n here
foo(list);
}else{
error("Database returned a list of incorrect size.");
}