Don wrote: > The pure function memoisation issue: > Certain functions may be marked as 'pure', even though they use floating > point (and are therefore dependent on the FP state). The compiler must > be able to prevent memoisation of those functions in cases where the > rounding mode may have changed. (Or, equivalently, the memoisation must > include the FP state).
Don't forget that "uses floating point" is a transitive property. Any pure function that calls a pure-but-unmemoisable function is itself pure-but-unmemoisable. The "pure" annotation is now used for two related but different categories of functions with different properties, and the compiler needs some way to keep track of which is which across module boundaries. If the compiler can do that, then it can use the same mechanism to differentiate between pure and non-pure functions, and the "pure" annotation becomes redundant. Is there any real need to treat floating point state differently from other global state in regard to "pure"? -- Rainer Deyke - [email protected]
