Postblit bug

IgorStepanov via Digitalmars-d digitalmars-d at puremagic.com
Fri Oct 17 07:41:36 PDT 2014


On Friday, 17 October 2014 at 14:18:31 UTC, monarch_dodra wrote:
> 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. It's really 
> just the "base" attribute between mutable and immutable data. 
> In particular, due to the transitive nature of const, any time 
> you use const it means "you can't modify this, or anything 
> produced or acquired from this, ever". It's usually not what 
> people think they are signing for...
>
> When it makes little sense to have your type as immutable, then 
> I don't think you should bother much

What happends if we will ignore const/immutable modifier for 
postblits? Is it create any holes?


More information about the Digitalmars-d mailing list