J3/06-273 Date: 10 August 2006 To: J3 From: Dick Hendrickson Subject: Macros, kinds, integration, and feature creep References: J3/06-007 One of the major driving forces behind the intelligent macro feature was the desire to have some sort of template available. Then generic entities, like Bessel functions, which merely differ in arguments kinds and have essentially the same body can be easily written. The current macro is a little weak in this. Note 3.15 (page 39) shows the contortions needed to generate functions that cover all of the real kinds. It's not immediately obvious what this does, nor that it covers all of the kinds available (and if Malcolm's comment on the bit intrinsic is correct, it stops way short of being complete). I propose that we add a new family of intrinsic functions --NEXT_REAL_KIND(k), etc. They return the next processor supported kind number greater than k, or -1 if k is greater than or equal to the maximum. Then the example could be written as: i = -1 MACRO DO !yes, we'll have to do this also i = next_real_kind(i) macro if (i < 0 ) macro exit ! yes again function i_square_range_%%i(a) result (r) ... I think that's easier to understand, less error prone, and more in the spirit of template programming. The functions have moderate general use. We could add them to chapter 13, or we could prefix them with "macro_" and make them local syntax things to the macro facility.