Why is ''' used for multiline strings in Delphi?

178 Views Asked by At

The Delphi programming language recently introduced multiline strings with the release of Delphi 12, but I would like to know why the following way was used for multiline strings instead of the way other languages do it?

I much prefer the way JavaScript does it using ` for multiline strings. This seems much better, so why did Delphi decide to use ''' over something like `?

In JavaScript, it is:

var html = `
  <div>
    <span>Some HTML here</span>
  </div>
`;

One simple ` seems much better. What's the reason for '''?

1

There are 1 best solutions below

0
On BEST ANSWER

The new syntax takes inspiration* from C#'s raw string literals, which uses (but is not limited to) """.

* New features introduced in Delphi over the last decade or so take a lot of inspiration from C#.

For what's it worth, Embarcadero did consider using backticks/delimiters like you are suggesting, amongst other approaches. What we have now is what they finally settled on.