Re:Why don't more languages offer flow typing?
by phillipcarter on Monday April 04, 2022 @11:37AM
(#30907882)
It's not really called out as such, but the C# 8 feature Nullable Reference Types is an example of deeply embedding flow typing into a language. The nullability state of a reference type can change based on many things you can do in code. It's really neat and extremely intricate.
[ Parent
| on HN ]
Re:Why don't more languages offer flow typing?
by SideburnsOfDoom on Monday April 04, 2022 @03:33PM
(#30911029)
It's exactly that.
e.g. inside "if (x != null) { }", or after "x = y ?? throw new ArgumentNullException()" then x is known not null.
C# has flow types, but only in this specific and limited way. You could say that about a lot of programming language features.