Getting the const-correctness of Object sorted once and for all

deadalnix deadalnix at gmail.com
Mon May 14 11:58:52 PDT 2012


Le 14/05/2012 00:56, Mehrdad a écrit :
> On Sunday, 13 May 2012 at 22:51:05 UTC, Jonathan M Davis wrote:
>> Anything that absolutely requires them will probably have to either
>> have to break the type system or use _other_ functions with the same
>> functionality but without those attributes. In some cases though,
>> providing overloads which aren't const, pure, etc. should work though.
>> If you want it to be otherwise, you're going to have to convince
>> Walter, and I think that it's pretty clear that this is the way that
>> it's going to have to be thanks to how const et al. work.
>
> This is *exactly* the sort of problem I was referring to in my
> const(rant) thread, so to speak.
>
> These const-related issues make D, simply speaking, *HARD TO USE*.
> (Yes, that means even harder then C++ in some cases.)
>
> When people say it's painful to find workarounds to problems in D, I
> hope -- at the very least -- no one will be surprised as to why.

The only reason I'd see a toSting function as non pure or non const is 
memoize. It can be tackled with lib support in phobos.

What are other uses cases ?


More information about the Digitalmars-d mailing list