Note: information on this page refers to Ceylon 1.1, not to the current release.

Meta references

Meta references are a way to obtain models from ceylon.language.meta.model and declarations from ceylon.language.meta.declaration.


Obtaining models:

Class<String, [{Character*}]> cls = `String`;

Interface<{String*}> iface = `Iterable<String, Null>`;

Function<Integer?, [{Integer*}]> func = `max<Integer, Null>`;

Method<Integer, Integer, [Integer]> meth = ``;

Value<Basic> val = `process`;

Attribute<String, String> attr = `String.string`;

UnionType<String|Integer> union = `String|Integer`;

Type<Nothing(String)> intersection = `String(String)&Integer(String)`;

Obtaining declarations:

ClassDeclaration c = `class String`;

InterfaceDeclaration i = `interface Iterable`;

FunctionDeclaration f = `function max`;

FunctionDeclaration iterator = `function Iterable.iterator`;

ValueDeclaration vm = `value process`;

ValueDeclaration str = `value String.string`;

Module m = `module ceylon.language`;

Package p = `package ceylon.language`;

class TypeParameterExample<Other>() {
    TypeParameter otherDecl = `given Other`;



To obtain model references you just enclose the name of the thing you're refering to in backticks (`). Type arguments are required for generic references.

To obtain declaration references you also need to use the relevant keyword for the declaration. That is, what you would use to declare the element you are referring to. Type arguments are not required (though not an error).


The type of a model reference depends on the thing being referred to, as detailed in the spec.

The type of a declaration reference also depends on the thing being referred to, as detailed in the spec.

See also