The concepts feature of Nim really looks like what your looking for https://nim-lang.org/docs/manual.html#concepts