Type signature

Type signature

Type signature is a term that is used in computer programming.

A type signature defines the inputs and outputs for a function or method. A type signature includes at least the function name and the number of its parameters. In some programming languages, it may also specify the function's return type or the types of its parameters.

Haskell

A type signature in the Haskell programming language is written, generally, in the following format: functionName :: arg1Type -> arg2Type -> ... -> argNType

Notice that the final output can be regarded as an argument. This is a consequence of currying. That is, given a function that had one argument supplied, but takes in two inputs, the function is "curried" and becomes a function of one argument -- the one that is not supplied.

The actual type specifications can consist of an actual type, such as Integer, or a general type variable that is used in parametric polymorphic functions, such as "a", or "b", or "anyType". So we can write something like: functionName :: a -> a -> ... -> a

Since Haskell supports higher-order functions, functions can be passed as arguments. This is written as: functionName :: (a -> a) -> a

This function takes in a function with type signature a -> a, and returns data of type "a" out.

Java

In the Java virtual machine, "internal type signatures" are used to identify methods and classes at the level of the virtual machine code.

Example:The method String String.substring(int, int) is represented as java/lang/String/substring(II)Ljava/lang/String;

C

In C, declaration reflects use; thus a function pointer that would be invoked aschar c;double d;int retVal = (*fPtr)(c, d);

has the signature

int (*fPtr)(char c, double d);

ee also

* Method signature


Wikimedia Foundation. 2010.

Игры ⚽ Нужна курсовая?

Look at other dictionaries:

  • Type inference — Type inference, or implicit typing, refers to the ability to deduce automatically the type of a value in a programming language. It is a feature present in some strongly statically typed languages. It is often characteristic of but not limited to …   Wikipedia

  • Type system — Type systems Type safety Inferred vs. Manifest Dynamic vs. Static Strong vs. Weak Nominal vs. Structural Dependent typing Duck typing Latent typing Linear typing Uniqueness typing …   Wikipedia

  • Signature (logic) — In logic, especially mathematical logic, a signature lists and describes the non logical symbols of a formal language. In universal algebra, a signature lists the operations that characterize an algebraic structure. In model theory, signatures… …   Wikipedia

  • Signature (disambiguation) — A signature is a hand written, stylized version of someone s name.Signature may also mean: NOTOC In computers*Signature block, text automatically appended at the bottom of an e mail message, Usenet article, or forum post. *Method signature, in… …   Wikipedia

  • Signature Series Vol 4 — Infobox Album Name = Signature Series Vol 4 Type = studio Artist = Ali Akbar Khan Pandit Nikhil Banerjee Border =yes Released = 9 August 1994 Recorded = Genre = Hindustani Classical Length = 42:57 Label = AMMP Producer = Reviews = Chronology =… …   Wikipedia

  • Signature (aéronautique) — Signature en télédétection Pour les articles homonymes, voir Signature. La signature est l ensemble des éléments qui permettent de caractériser la présence, le type, ou l identité d un objet par un senseur. Elle dépend donc des phénomènes… …   Wikipédia en Français

  • Signature (domaine technique) — Signature en télédétection Pour les articles homonymes, voir Signature. La signature est l ensemble des éléments qui permettent de caractériser la présence, le type, ou l identité d un objet par un senseur. Elle dépend donc des phénomènes… …   Wikipédia en Français

  • Signature Infra Rouge — Signature en télédétection Pour les articles homonymes, voir Signature. La signature est l ensemble des éléments qui permettent de caractériser la présence, le type, ou l identité d un objet par un senseur. Elle dépend donc des phénomènes… …   Wikipédia en Français

  • Signature SER — Signature en télédétection Pour les articles homonymes, voir Signature. La signature est l ensemble des éléments qui permettent de caractériser la présence, le type, ou l identité d un objet par un senseur. Elle dépend donc des phénomènes… …   Wikipédia en Français

  • Signature SIR — Signature en télédétection Pour les articles homonymes, voir Signature. La signature est l ensemble des éléments qui permettent de caractériser la présence, le type, ou l identité d un objet par un senseur. Elle dépend donc des phénomènes… …   Wikipédia en Français

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”