I want to explore a different way of doing parametric polymorphism. Most languages do it the same and it does lead to "going down the rabbit hole", like what you have suggested.
I personally don't think something like concepts is worth the trouble as the complexity of its implementation and complexity of understanding it is much greater than its usefulness (in my opinion). This language is meant to be a simple one and not the behemoth that is C++ (or Rust for that matter).
Maybe, the best idea is have a limited set of "traits/concepts/interfaces". Maybe just one for iterators. However, the path I would like to explore is code generation. C++ templates (and the like) are a kind of poor man's code generator and because of its design, require a ton of complexity to enforce its rules.
I personally find that the only things that I need to be "generic" or "parametric" are 3 things:
* Dynamic Arrays
* Dynamic Hash Tables
* General sorting function
In C, I can emulate all of these with macros and x-macros and its good enough to solve 99% of the problems I have. I don't really need anything else like that.
When compile time execution (CTE) is implemented, it will be possible to emulate most of the functionality that those type restrictions bring and be written in
normal code.
| #run assert(is_type_iterable(type_info(Foo_Type)));
|
Maybe semantic macros + CTE is the answer that will solve most of mine (and others) problems whilst still being "simple enough" concepts.
- Bill