Nim-lang: OOP features supported?

Viewed 53

While learning basics of Nim-lang, I have read that the OOP is minimalistic in Nim;
But I would like to know what features are exactly supported?

Like:

  • Over-ride.
  • Over-load (not supported by PHP yet, 2022).
  • Multi-inheritance (not supported by any language I know, if any, except C++).
  • Generics.
  • Classes.
  • Namespaces.
  • Import-as/from-namespace (or Include-file-content like C/C++).
  • Custom type-defs (name aliases).
  • Custom operator implementation(s).
  • Traits (saw only in PHP, if this is even OOP?).
1 Answers

BTW, most of the items on this list aren't OOP specific or even related to the OOP paradigm

Yes

  • Over-ride.
  • Over-load.
  • Generics.
  • Import-as/from-namespace (or Include-file-content like C/C++).
  • Custom type-defs (name aliases).
  • Custom operator implementation(s).

No

  • Multi-inheritance.
  • Traits.

Weakly

  • Classes. (Well Kinda. Polymorphism only really work on ref types)
  • Namespaces. (Not really, but you can force it to use an empty type as the first argument or store everything in a variable and don't export anything)
Related