objeck / objeck-lang

Objeck is a modern object-oriented programming language with functional features tailored for machine learning. It emphasizes expression, simplicity, portability, and scalability. The programming environment consists of a compiler, virtual machine, REPL shell, and command line debugger with IDE plugins.
https://objeck.org
Other
154 stars 11 forks source link

Verbatim strings #474

Closed ghost closed 7 months ago

ghost commented 7 months ago

I got the idea from C#:

https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/tokens/verbatim

C# interpolated strings started with $ character:

https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/tokens/interpolated

Objeck strings support interpolation by default, so you could reuse the $ character, or simply use the @ character like C#.

ghost commented 7 months ago

If you don't like C#'s syntax, you could have a look at Go's backquoted strings. But Go's syntax has more limitations than C#'s:

https://stackoverflow.com/questions/4423951/how-to-put-a-backquote-in-a-backquoted-string

objeck commented 7 months ago

Added, here is an example:

v1 := $"c:\documents\files\u0066.txt";
v2 := "c:\\documents\\files\\u0066.txt";
v1->Equals(v2)->PrintLine();