Concatenate strings at compile-time

Jonathan M. Wilbur jonathan at wilbur.space
Wed May 2 12:38:25 UTC 2018


I have a method that cannot be @nogc only because it concatenates 
strings for a long exception message, as seen below.

             throw new ASN1ValuePaddingException
             (
                 "This exception was thrown because you attempted 
to decode " ~
                 "an INTEGER that was encoded on more than the 
minimum " ~
                 "necessary bytes. " ~
                 notWhatYouMeantText ~ forMoreInformationText ~
                 debugInformationText ~ reportBugsText
             );

Those variables you see are immutable. Is there a way that I can 
combine these strings together at compile time, rather than 
having a really long string that exceeds the 120 hard line-length 
limit?


More information about the Digitalmars-d-learn mailing list