Content deleted Content added
→Ceylon: Restore layout of example. |
Fixed incorrect statements, added references to improve the historical record. |
||
Line 3:
In [[programming language theory]], '''flow-sensitive typing''' (also called '''flow typing''' or '''occurrence typing''') is a [[type system]] where the type of an [[Expression (computer science)|expression]] depends on its position in the [[control flow]].
In [[Static typing|statically typed languages]], a type of an expression is determined by the types of the sub-expressions that compose it. However, in flow-sensitive typing, an expression's type may be updated to a more specific type if it follows
== Examples ==
Line 76:
==Implementations==
Typed Scheme, a type system for [[Scheme (programming language)|Scheme]], was the first type system with this feature.<ref>{{cite web |title=The Design and Implementation of Typed Scheme {{!}} Lambda the Ultimate, 2008 |url=http://lambda-the-ultimate.org/node/2622 |website=lambda-the-ultimate.org}}</ref> Its successor, Typed Racket (a dialect of [[Racket (programming language)|Racket]]), still makes extensive use of occurrence typing.<ref>{{cite web |title=5 Occurrence Typing |url=https://docs.racket-lang.org/ts-guide/occurrence-typing.html |website=docs.racket-lang.org}}</ref> Shortly
There are also a few languages that don't have [[Tagged union|union types]] but do have [[nullable types]], that have a limited form of this feature that only applies to nullable types, such as [[C Sharp (programming language)|C#]],<ref>{{cite web |title=Design with nullable reference types |url=https://docs.microsoft.com/en-us/dotnet/csharp/tutorials/nullable-reference-types#create-respondents-and-get-answers-to-the-survey |website=docs.microsoft.com |language=en-us}}</ref> [[Kotlin (programming language)|Kotlin]],<ref>{{cite web | url=https://kotlinlang.org/docs/reference/null-safety.html | title=Null Safety | publisher=kotlinlang.org | accessdate=11 March 2016}}</ref><ref>{{cite web | url=https://kotlinlang.org/docs/reference/typecasts.html | title=Type Checks and Casts | publisher=kotlinlang.org | accessdate=11 March 2016}}</ref> and Lobster.<ref>{{cite web |title=The Lobster Type System |url=http://aardappel.github.io/lobster/type_checker.html#the-trouble-with-nil |website=aardappel.github.io}}</ref>
|