Feedback for generics prototype

Can you share the link to your bug report? I don’t see it at: Issues · lfortran/lfortran · GitHub

Are you talking about this example: https://github.com/lfortran/lfortran/blob/9a67f4916328e355276f033fea0eadb8c2ff703f/integration_tests/template_add.f90 ?

In there, the generic code is:

        function add_generic(x, y) result(z)
            type(T), intent(in) :: x, y
            type(T) :: z
            z = F(x, y)
        end function

Similar to your C++ example. It’s calling a user defined F function, so you have to define it as a user.

In order to just use the + operator, we have a work in progress pull request here: https://github.com/lfortran/lfortran/pull/1268, and more is needed, see our TODO list here: Templates TODO · Issue #1199 · lfortran/lfortran · GitHub, eventually for these simple cases the compiler will be able to just work for builtin types and arithmetic operators. Until then just define these operations explicitly.