News for hackers. Stuff that matters.
Re:Swift for TensorFlow Shuts Down by uryga on Friday February 12, 2021 @07:26PM (#26120268)
> I can't speak to why run-time checking wasn't built into the language as a default behavior

tldr: you other get either huge overhead or need to type annotate everything like it's Java, and it'll still be pretty limited/not super useful

---

there's a bunch of libraries that do this, and they're all fundamentally limited [though i guess some of these may just be failures of imagination on my part]:

- hard to check generics: if it's a builtin, you have to traverse the whole structure and check every element. and for user-defined collections, the programmer has to to manually instantiate every generic like:

  CoolSequence[int]([1,2,3])
(which sucks) and every method call/property access needs to be checked

- if your function takes a callback, there's no way to typecheck that callback at runtime (without calling it, at which point it's not terribly useful. which extends to all functions i guess)

- not much you can do with iterators/generators. can't check if something really is an `Iterator[int]` without exhausting it, and e.g. type-erroring after processing 20 elements because it yielded not-an-int isn't very useful

so in the end, even if you wrap Every Damn Thing in a type assertion, you still get the errors very late, not much sooner than your usual "AttributeError: object None has no property named 'foobar'". kind of a worst-of-both-worlds situation

Re:Swift for TensorFlow Shuts Down by pjmlp on Saturday February 13, 2021 @04:39AM (#26122533)
> tldr: you other get either huge overhead or need to type annotate everything like it's Java, and it'll still be pretty limited/not super useful

Still using Java 8 are we?

Re:Swift for TensorFlow Shuts Down by mumblemumble on Saturday February 13, 2021 @11:17AM (#26124442)
I'm pretty sure the level of type annotation you'd get roped into doing would be about on par with what you get in Java 10: function parameter and return types, but not local variable types.
Re:Swift for TensorFlow Shuts Down by uryga on Saturday February 13, 2021 @12:44PM (#26125098)
i'm aware Java has type inference now. but i've got some not-so-fond memories of learning it when it didn't :)