Postblit bug

Dmitry Olshansky via Digitalmars-d digitalmars-d at puremagic.com
Sun Oct 19 11:31:59 PDT 2014


17-Oct-2014 18:18, monarch_dodra пишет:
> On Friday, 17 October 2014 at 00:55:25 UTC, ketmar via Digitalmars-d wrote:
>> On Fri, 17 Oct 2014 00:42:24 +0000
>> IgorStepanov via Digitalmars-d <digitalmars-d at puremagic.com> wrote:
>>
>>> Can someone comment this code? Should I think that it's a bug.
>> it's just an anomaly. const postblit can do alot of things besides
>> adjusting struct fields, and it's logical that compiler cannot call
>> non-const methods for const objects.
>>
>> yet it's still on of those "unforseen consequences" that arises from
>> conjunction of different features.
>>
>> i don't think that it's a bug, but i think that this must be discussed
>> anyway, and then documented.
>
> AFAIK, Kenji has submitted a DIP, and has begun working on "fixing" the
> const/immutable/inout posblit issue.
>
> However, there are some very subtle corner cases, so (afaik) work is slow.
>
> To be honest, I think people use "const" way too much in D. It's *not*
> the C++ head const you can use anywhere.

s/can/need to/

Which in case of const T& is a just a kind of mnemonic to accept both 
l-value and r-value.

Anyhow I think we can probably extend final to mean single-assignment 
field (a-la Java). But the gain to semantic load factor is too small IMHO.


-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list