To help LDC/GDC
Manu
turkeyman at gmail.com
Tue Apr 9 09:46:20 PDT 2013
On 10 April 2013 00:07, kenji hara <k.hara.pg at gmail.com> wrote:
> 2013/4/9 Dicebot <m.strashun at gmail.com>
>
>> On Tuesday, 9 April 2013 at 12:56:04 UTC, Andrei Alexandrescu wrote:
>>
>>> It is valid code. It is "weak pure". "pure' keyword means both
>>>> "strong pure" or "weak pure" depending on function body. Crap.
>>>>
>>>
>>> s/body/signature/
>>> s/Crap/Awesome/
>>>
>>
>> Not gonna argue latter but former is just wrong.
>>
>> struct Test
>> {
>> int a;
>> pure int foo1() // strong pure
>> {
>> return 42;
>> }
>>
>> pure int foo2() // weak pure
>> {
>> return a++;
>> }
>> }
>>
>> Signature is the same for both functions.
>>
>
> Both have weak pure. Purity is always calculated only from the function
> signature.
> If you make member function "strong pure", _at least_ it should be
> qualified with "immutable".
>
> pure int foo3() immutable // strong pure
> {
> return 10;
> }
>
> Kenji Hara
>
What is an immutable function? Why is const not sufficient?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130410/f6b6b8d5/attachment.html>
More information about the Digitalmars-d
mailing list