Methods overloaded on differently parameterised Lists

The complete source of generics_separate_types.ek9, compiled by the EK9 compiler. Shown on generics.html.

#!ek9
defines module site.generics.separateTypes

  defines class

    Shape as abstract
      shapeName() as pure abstract
        <- rtn as String?

    Circle extends Shape
      override shapeName() as pure
        <- rtn as String: "circle"

    Square extends Shape
      override shapeName() as pure
        <- rtn as String: "square"

    SimpleExample as abstract
      assimilate() as pure abstract
        -> items as List of Shape
        <- rtn as Shape?

      assimilate() as pure abstract
        -> items as List of Circle
        <- rtn as Shape?

      assimilate() as pure abstract
        -> items as List of Square
        <- rtn as Shape?

Download generics_separate_types.ek9