Proposal: fixing the 'pure' floating point problem.

Walter Bright newshound1 at digitalmars.com
Fri Mar 13 19:56:55 PDT 2009


Jason House wrote:
> Walter Bright Wrote:
> 
>> While it's a good suggestion, I think there's a fundamental problem
>> with it. Suppose a function in the floatingpoint module calls foo()
>> in a non-floatingpoint module which calls std.math.sin(x).
>> std.math.sin(x) is marked as "pure" in a non-floatingpoint module.
>> So, inside foo(), it is assuming that sin(x) is pure and caches the
>> value, while its caller is manipulating the rounding mode and
>> making repeated calls to foo() expecting different answers.
> 
> Maybe I misinderstood, but I thought anything marked module(system)
> could not call anythimg that wasn't.

No, all system means is no checking is done for safe mode, even if the 
compiler switch says to.

> I assumed this proposal would
> mean that module(floatingpoint) could not call code that wasn't
> marked the same way.

If so, it couldn't call any library functions.



More information about the Digitalmars-d mailing list