Our great sponsors
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
As a mainstream dynamic language, Julia has a fair exploration of this idea, see https://github.com/JuliaLang/julia/issues/19206 . It might have been a syntactic sugar if not conflicting with the "type assertion" syntax. Anyhow, having the desired return type as one extra input arg, which is conventional in Julia, is a pretty pragmatic choice. You do not do type inference in your dynamic PL, so the end programmers have to be explicit in some way, right?
Well, my worry is that people will come along and say "This language doesn't have return type overloading, it's verbose and it sucks". Take an example of readMaybe. Ignoring the monomorphism restriction, all the type signatures in there are optional (inferrable) and can be removed - the result looks just like a dynamic program because there aren't any types. So from this example it seems Haskell is more expressive than a dynamic language. Admittedly, this example only works because of Haskell's defaulting rules that choose Integer - so maybe it is a story of a nice-looking syntax held together with rubber bands and glue.