23 Sep
2020
23 Sep
'20
9:13 a.m.
Am 22.09.20 um 18:39 schrieb dimvar--- via Typing-sig:
Re: the use of AnyOf for typing. I agree with the folks saying that it's probably not a good idea to introduce an unsafe union. In the cases where more type safety than just using Any is desired, one can use an ordinary union, and the callers of the function can cast the result to their desired type.
Unfortunately that is not true as the many examples in the originally mentioned ticket prove. Experience has shown that safe unions are inconvenient as return types in many cases, especially when typing previously untyped code. Unsafe unions provide a substantial type safety benefit over the only alternative of using Any. - Sebastian