typedef t n | C, C++, Pike |
type n is t | Ada |
type n ... | Pliant |
type n = t | F#, Haskell, OCaml, Pascal, SML |
TYPE n = t | Modula-3 |
using n = ... | C# |
data n = t | Haskell |
datatype n = t | SML |
newtype n = t | Haskell |
n = t | merd, Python |
n : t | Beta |
(deftype n () 't) | Common Lisp |
type n t | Go |
: | Ada, E, Eiffel, F#, Modula-3, OCaml, Pascal, SML |
:: | Dylan, Haskell, Mercury |
!! | merd |
t v | C, C#, C++, Java, Perl6, Pike, Pliant, YCP |
(declare (t v)) | Common Lisp |
v :@ t | Beta |
_t(1) | Mathematica |
var n t | Go |
upcast
(t) e | C, C#, C++, Java, PHP |
t(e) | Ada, Pascal |
[t] e | Pike |
static_cast<t>(e) | C++ |
e :> t | OCaml |
e : t | F# |
upcast e | F# |
CAST(e as t) | SQL92 |
typecast(e,t) | Matlab |
(t)(e) | Go |
downcast (need runtime checking)
(t) e | Java |
t(e) | Ada |
e : t | E |
[t] e | Pike |
dynamic_cast<t>(e) | C++ |
e as t | C# |
e :?> t | F# |
downcast e(2) | F# |
v ?= e(3) | Eiffel |
NARROW(e, t) | Modula-3 |
typecast(e,t) | Matlab |
computed conversion (calls an internal or a user-defined function)
(t) e | C++, Pike |
[t] e | MSH |
t(e) | C++, Matlab, Python |
t e | F# |
e : t | E |
e :: t | Haskell |
cast e t | Pliant |
... cast t | Pliant |
make t e / to t e | Rebol |
type of a mutable value
mutability is the default | C, C#, C++, Go, Java, Matlab |
val x: T | Pascal |
T ref | F#, OCaml, SML |
STRef a T | Haskell |
in out T(4) | Ada |
type of a constant value
const T | C++, C99 |
constant T | Ada |
const x: T | Pascal |
constness is the default | F#, Haskell, OCaml, SML |
const e t | Go |
special cases
"readonly" fields(5) | C# |
"final" fields, parameters, local variables(5) | Java |