generics icon indicating copy to clipboard operation
generics copied to clipboard

22-120r2 Generics formal requirements: Overcoming strong concept clunkiness

Open zjibben opened this issue 3 years ago • 2 comments

https://github.com/j3-fortran/generics/blob/4e273a9b394a0e48a217fcf307c0ddb598475dd2/J3-Papers/Generics_Requirements.txt#L196-L202

A colleague at LANL recently told me strong concepts sound cumbersome, in certain scenarios. For instance, if you have a deep tree of templated code, and you need to call a new function at the bottom, it's necessary to add a requirement for that interface at every level of the call stack. In some sense this is like passing data by argument, but this would be especially tedious when temporarily introducing extra operations for debugging purposes. Has subgroup discussed ways to mitigate this?

zjibben avatar Mar 03 '22 17:03 zjibben

Subgroup has discussed the issue, but ... guidance from our outside expert is that we should not poke holes in the system. One solution would be for compilers to simply provide a switch which deprecates violations of STRONG to merely a warning.

One related issue which has not quite been addressed is PRINT, WRITE, and READ. These are not procedures and thus are not currently disallowed in the specs, but ... they would be difficult to use in most templates. And I imagine that they will be appropriately constrained by the time we are done with the feature.

tclune avatar Mar 03 '22 17:03 tclune

I see, yes this seems a fundamental cost to strong concepts (though not necessarily an overriding cost). A compiler switch would be a fair solution for debugging, assuming that's feasible for vendors to consider.

zjibben avatar Mar 03 '22 19:03 zjibben