Shorthand for a trait and for extending a class

The complete source of structure_shapes_shorthand.ek9, compiled by the EK9 compiler. Shown on structure.html.

#!ek9
defines module site.structure.shapesshorthand

  defines trait

    ShapeLimit allow only Ellipse
      printDrawing()
        -> message as String
        Stdout().println(message)

  defines class

    //Could have been written in shorthand like this
    Shape with trait ShapeLimit as abstract
      draw() as abstract

    //This could have been written like this
    Ellipse is Shape as open
      override draw()
        printDrawing("Ellipse")

  defines program

    DrawShorthand()
      Ellipse().draw()

Download structure_shapes_shorthand.ek9

Output

Ellipse