Prototype of Ownership/Borrowing System for D
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Fri Nov 22 07:40:30 UTC 2019
On Friday, 22 November 2019 at 06:43:01 UTC, mipri wrote:
> I've never used TypeScript, but Kotlin's handling of nullable
> is nice to the point I'd rather use the billion dollar mistake
> an optional type.
Kotlin has type inference, but TypeScripts has to be able to
consequence TypeScript has to allow "crazy" mixing of types. Thus
a function can have parameters and a return type that is a union
of "incompatible" types. To make this work it fully embraces
flow-typing, that is: the type is determined by all possible
execution paths within a function. Thus TypeScript has many
features to deal with "undefined" (unitialized or non-existing
variable) and "null" (missing object) as you have to deal with
valuable tool when transitioning code to TypeScript from
The verification language Whiley is following the same core
flow-typing principle, but since the type system of Whiley
employs a SMT engine it has more potential than TypeScript IMO.
See page 8 in
http://whiley.org/download/GettingStartedWithWhiley.pdf . (I
don't think it is production ready, but interesting nevertheless).
More information about the Digitalmars-d