News for hackers. Stuff that matters.
Re:Swift for TensorFlow Shuts Down by lmm on Saturday February 13, 2021 @06:50PM (#26128213)
> In the case that the third party code does in fact always return no empty lists of positive numbers, the author might just type it as a list.

Yes - but as I said, you can be confident that the list type is accurate, and if you want to convert that list to a specific-length list type then you're nudged towards doing it in a way where you handle the case where the list isn't actually the length you specified.

> And by the List[str] bit, I mean you can annotate it as doing whatever it in fact does. You aren’t protected if you get that wrong, of course

Not "of course"; the whole point of a type system is that it's automatically checked and therefore you can have reasonable confidence in the types you're given.

Re:Swift for TensorFlow Shuts Down by 6gvONxR4sf7o on Sunday February 14, 2021 @02:29AM (#26130390)
> You aren’t protected if you get that wrong, of course, and that’s where things like stubs come in to help.
Re:Swift for TensorFlow Shuts Down by lmm on Sunday February 14, 2021 @03:04AM (#26130501)
They don't really though? Stubs are just as unchecked as writing the type signature yourself, so even if they're correct at a given point in time, they'll tend to become incorrect for subsequent releases of the libraries they cover.