Type Inference

From The Oxygene Language Wiki

Jump to:navigation, search

This is a Language topic
Feel free to add your notes to this topic below.



Variable Type Inference allows you to declare local variables without having to specify the type, provided that the type can be determined from the context.

For example,

var x := new SomeTypeName(...);

replaces

var x : SomeTypeName := new SomeTypeName(...);

Scope

Variable Type Inference applies to simple types as well, e.g.

var x := 3;
  var s := 'Hello';

The assignment will be to the lowest type possible, e.g. integer rather than longint.

Only local and inline variables are supported currently.


See Also


Oxygene-48.png

Area: Oxygene Language
Compiler version: Oxygene 5

Language GlossaryKeywordsTypesFAQHow To

Navigation
Areas
More
Toolbox