Why is Exceptions c'tor this(immutable(char[]) instead of const(char[]) ?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Aug 26 14:22:29 PDT 2010


On 8/26/10 13:05 PDT, Mathias Laurenz Baumann wrote:
> Well, topic says it all. Why is the string parameter for the Exception
> class in object.di an immutable(char[])?
>
> A const(char[]) works for both, immutable(char[]) types and char[]
> types. why this limitation?
>
>
> --Marenz

The string is stored inside the Exception object. If it's immutable then 
there's a guarantee it will last forever.

Andrei


More information about the Digitalmars-d mailing list