To help LDC/GDC
Simen Kjærås
simen.kjaras at gmail.com
Thu Apr 11 03:09:31 PDT 2013
On Thu, 11 Apr 2013 12:03:38 +0200, deadalnix <deadalnix at gmail.com> wrote:
> On Thursday, 11 April 2013 at 08:36:13 UTC, Joseph Rushton Wakeling
> wrote:
>> On 04/10/2013 08:39 PM, Walter Bright wrote:
>>> Sure there is. Declare the function as pure, and the function's
>>> parameters as
>>> const or immutable.
>>
>> Sure, I accept that. What I was meaning, though, was an up-front
>> declaration
>> which would make the compiler shout if those necessary conditions were
>> not met.
>>
>> i.e.
>>
>> pure foo(int n) { ... } // compiles
>>
>> strong pure bar(int n) { ... } // compiler instructs you to make
>> // variables const or immutable
>
> Both are strongly pure.
That's not the point. The point is, if he'd written this:
strong pure bar(int* n) { ... }
The compiler would have said 'Bad programmer! int* is not implicitly
castable to immutable!'
--
Simen
More information about the Digitalmars-d
mailing list