Reflect

Interfaces

Interfaces are an abstract description of methods and properties a user-defined type exhibits. By themselves, they are closer to Rust's traits or C++'s concepts than the type of interfaces found in C# or D.

⚠️ TODO

Example

interface I {
	function foo(): void;
}

// s is a generic parameter that accepts any
// type that implements I
function test(s: I)
{
	s.foo();
}

function main()
{
	struct S: I {
		function foo() { print("Hello"); }
	}

	test(S());
}