Most languages either lack type annotations or recognize some kind of "interface" descriptor of types. As with member variable declarations, declaring an interface is allowed in Budgie and only creates code in strongly or gradually typed languages.
interface start
takes in a PascalCase name of an interface followed by any number of interfaces to extend from. End an interface with interface end
.
Declare public methods on an interface with interface method
, which takes the name of the method in PascalCase, the return type, followed by any number of (name, type) parameters.
interface start : IShapeinterface method : GetArea doubleinterface end​interface start : IPolygon IShapeinterface method : GetPerimeter doubleinterface end
In C#:
interface IShape{double GetArea();}​interface IPolygon : IShape{double GetPerimeter();}
You can export interfaces from the current file by including the export
keyword before the interface's name.
interface start : export IShapeinterface method : GetArea doubleinterface end
In C#:
public interface IShape{double GetArea();}