#compiler v0.1.0

Source
Compile-time information about the compiler performing the build.

Package: Rux

Definition

intrinsic #compiler: Compiler;

struct Compiler {
    version: SemanticVersion;
}

extend Compiler {
    intrinsic func HasFeature(self, feature: Slice<char8>) -> bool;
}

#compiler is a compile-time value describing the compiler itself: its version, and a HasFeature query for capabilities that a program may want to gate on.

SemanticVersion

struct SemanticVersion {
    major: uint;
    minor: uint;
    patch: uint;
}

SemanticVersion carries the three numeric components of a semantic version and orders them by precedence. It provides New, a Compare returning -1, 0, or 1, the named comparisons IsEqualTo / IsLessThan / IsAtMost / IsGreaterThan / IsAtLeast, and the comparison operators ==, !=, <, <=, >, >=.

Example

import Core::{ #compiler, SemanticVersion };
import Io::PrintLine;

func Main() -> int {
    if #compiler.version >= SemanticVersion::New(0, 3, 0) {
        PrintLine("compiler is new enough");
    }
    return 0;
}

See also