Why Throwable.message is not a property

uranuz neuranuz at gmail.com
Wed Mar 17 20:46:26 UTC 2021


On Wednesday, 17 March 2021 at 19:38:48 UTC, Adam D. Ruppe wrote:
> On Wednesday, 17 March 2021 at 19:32:02 UTC, uranuz wrote:
>> Seems that a problem with concatenation is because 
>> Throwable.message has const(char)[] type, but not string. This 
>> makes some inconvenience ;-)
>
> Yes, that's what I thought.
>
> The concat operation tends to give the most flexible type of 
> the arguments... and I wish it would then ACTUALLY use that 
> flexibility... but it doesn't.
>
> Regardless though since you know you are concating it, which 
> means you get a new string anyway, you can safely cast(string) 
> it.
>
> string longMsg = "The: " ~ cast(string) exc.message;
>
> that's how i do it.

This is what I have done ;-)


More information about the Digitalmars-d-learn mailing list