Hm, in my mind they serve exactly the same purpose, it’s just a different way you write the requirement, in fact that’s likely how we will implement it also. The type(real, integer, logical)
in my mind is just a type T
with a requirement real | integer | logical
meaning only those types can work. In fact it’s been requested to be able to write requirements in this way, see the examples in Traits, Generics, and modern-day OO for Fortran, such as Traits-for-Fortran/Code/Fortran/functional1.f90 at 51778c3a6ca47c9eda20e4450fe81708c67398b2 · difference-scheme/Traits-for-Fortran · GitHub.
How do these templates work differently? I can’t see any difference, except the slightly different / incompatible syntax? It would be good to unify it. Do you also call it with the ^()
syntax to specify exact types?