Why Throwable.message is not a property

Adam D. Ruppe destructionator at gmail.com
Wed Mar 17 19:38:48 UTC 2021


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.


More information about the Digitalmars-d-learn mailing list