It’s nice they tried with a more fleshed out exemplar. Polymorphism (“generics”) and interfaces (“OOP”) would have been even better to see, especially across any kind of visibility boundary enforced by the language (packages, and the like.)
Programming to an abstract interface — and in large codebases, enforced visibility controls — represent the middle ground everyone wants, in my experience, between “OOP” and “sir, this is C”.
> Polymorphism (“generics”) and interfaces (“OOP”) would have been even better to see
Yep. Interface-based (true) delegation between objects would be my go-to if it existed.
Subtyping and generics raise the question of whether containers are covariant or contravariant.
Yes,
The example definitely shines. Doing something barely non-trivial is great since it gives a feeling for the language. I wish other language introduction pages would take note.
loading story #50333015