Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2024-12

Current "state of opinion" on multiline strings? I still have this up-to-date locally with trunk FPC, despite having neglected pushing this anywhere online for a while now.

9 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Ben Grasset

Facts:
- Michael VC did not originally like the entire idea at all, if I recall correctly. However, he eventually added an implementation of it to Pas2JS that works literally the exact same as my main FPC compiler one does.
- Delphi (in the time since, as of version 12 I guess) has added this themselves. Their version is not quite the same (frankly in my opinion, theirs is overall worse than mine, for reasons such as the fact you HAVE to put the closing backticks of a multiline string on their own entire line in Delphi, whereas in my version the closing backticks could appear anywhere and be parsed correctly. And so on and so forth).

I'm as ready as I was several years ago to put this in main FPC if it'll be accepted, however, would people want me to now imitate the Delphi version (which again did not exist when I originally implemented the functionality for FPC, and again is functionally different from both the unmerged main compiler impl of mine and Michael VCs identical actually-existing impl for Pas2JS).

I'd certainly don't really WANT to adapt to the (like I said, worse in my opinion) Delphi version, but I would if I "had" to. So that's why I figured I'd check in to see what people's general thoughts are on all of this nowadays.

Reply by email

Mattias Gaertner
to Ben Grasset
Ben Grasset wrote 10 lines
Facts: - Michael VC did not originally like the entire idea at all, if I recall correctly. However, he eventually added an implementation of it to Pas2JS that works literally the exact same as my main FPC compiler one does. - Delphi (in the time since, as of version 12 I guess) has added this themselves. Their version is not quite the same (frankly in my opinion, theirs is overall worse than mine, for reasons such as the fact you HAVE to put the closing backticks of a multiline string on their own entire line in Delphi, whereas in my version the closing backticks could appear anywhere and be parsed correctly. And so on and so forth).

Delphi does not support backticks. I guess you mean the odd apostrophs?

Show quoted text 11 lines
I'm as ready as I was several years ago to put this in main FPC if it'll be accepted, however, would people want me to now imitate the Delphi version (which again did not exist when I originally implemented the functionality for FPC, and again is functionally different from both the unmerged main compiler impl of mine and Michael VCs identical actually-existing impl for Pas2JS). I'd certainly don't really WANT to adapt to the (like I said, worse in my opinion) Delphi version, but I would if I "had" to. So that's why I figured I'd check in to see what people's general thoughts are on all of this nowadays.

Are there cases where ported Delphi code creates a different string literal?

Mattias

Reply by email

Michael Van Canneyt
to Ben Grasset: Facts: - Michael VC did not originally like the entire idea at all, if I recall…
Ben Grasset wrote 17 lines
Facts: - Michael VC did not originally like the entire idea at all, if I recall correctly. However, he eventually added an implementation of it to Pas2JS that works literally the exact same as my main FPC compiler one does. - Delphi (in the time since, as of version 12 I guess) has added this themselves. Their version is not quite the same (frankly in my opinion, theirs is overall worse than mine, for reasons such as the fact you HAVE to put the closing backticks of a multiline string on their own entire line in Delphi, whereas in my version the closing backticks could appear anywhere and be parsed correctly. And so on and so forth). I'm as ready as I was several years ago to put this in main FPC if it'll be accepted, however, would people want me to now imitate the Delphi version (which again did not exist when I originally implemented the functionality for FPC, and again is functionally different from both the unmerged main compiler impl of mine and Michael VCs identical actually-existing impl for Pas2JS).

I implemented the Delphi version in pas2js as well meanwhile (on demand), So both work.

I personally prefer the backtick version, it is easier to use. but nothing prevents us from having both as in pas2js. The implementation can be orthogonal.

If you can change your implementation to actually support both ways, then
I'll make sure it is merged in the FPC compiler.

Michael.

Reply by email

Hairy Pixels
to Ben Grasset: Facts: - Michael VC did not originally like the entire idea at all, if I recall…

On Dec 22, 2024 at 9:29:37 AM, Ben Grasset via fpc-devel <

Show quoted text 7 lines
wrote: I'd certainly don't really WANT to adapt to the (like I said, worse in my opinion) Delphi version, but I would if I "had" to. So that's why I figured I'd check in to see what people's general thoughts are on all of this nowadays.

What is Delphi doing? This?

var s: String = ‘’'
hello world

                        ‘’’;

That or backticks are the only thing that made sense to me. What are the pros and cons of both? Backticks are easier to type maybe, but I kind of like the block effect the triple single-quotes make. Backticks are familiar from another popular language (JavaScript) so there’s that.

Regards,
Ryan Joseph

Reply by email

Hairy Pixels
to Michael Van Canneyt: I implemented the Delphi version in pas2js as well meanwhile (on demand), So both work. I…

On Dec 22, 2024 at 5:08:06 PM, Michael Van Canneyt via fpc-devel <

Show quoted text 5 lines
wrote: If you can change your implementation to actually support both ways, then I'll make sure it is merged in the FPC compiler.

Please do. I listened and engaged with all the commenters on the GitLab issue and all of the critics came down to “that’s not how we do things around here” or concerns about exact control over whitespace, which is totally irrelevant because it’s intended for embedding non-white space sensitive text.

I literally did not find a single rational justification for why any language should have not support them.

Regards,
Ryan Joseph

Reply by email

Marcos Douglas B. Santos
to Hairy Pixels: On Dec 22, 2024 at 9:29:37 AM, Ben Grasset via fpc-devel < What is Delphi doing? This?…
Show quoted text 15 lines
On Dec 22, 2024 at 9:29:37 AM, Ben Grasset via fpc-devel wrote: > > I'd certainly don't really WANT to adapt to the (like I said, worse in my opinion) Delphi version, but I would if I "had" to. So that's why I figured I'd check in to see what people's general thoughts are on all of this nowadays. What is Delphi doing? This? var s: String = ‘’' hello world ‘’’; That or backticks are the only thing that made sense to me. What are the pros and cons of both? Backticks are easier to type maybe, but I kind of like the block effect the triple single-quotes make. Backticks are familiar from another popular language (JavaScript) so there’s that.

Delphi 12 uses 3 apostrophes to initialize/finish a string block.

best regards,
Marcos Douglas

Reply by email

Ben Grasset
to Hairy Pixels: On Dec 22, 2024 at 9:29:37 AM, Ben Grasset via fpc-devel < What is Delphi doing? This?…

On Sun, Dec 22, 2024 at 5:15 AM Hairy Pixels via fpc-devel <

Show quoted text 29 lines
wrote: On Dec 22, 2024 at 9:29:37 AM, Ben Grasset via fpc-devel < > wrote: > I'd certainly don't really WANT to adapt to the (like I said, worse in my > opinion) Delphi version, but I would if I "had" to. So that's why I figured > I'd check in to see what people's general thoughts are on all of this > nowadays. > What is Delphi doing? This? var s: String = ‘’' hello world ‘’’; That or backticks are the only thing that made sense to me. What are the pros and cons of both? Backticks are easier to type maybe, but I kind of like the block effect the triple single-quotes make. Backticks are familiar from another popular language (JavaScript) so there’s that. Regards, Ryan Joseph _______________________________________________ fpc-devel maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

The Delphi 12 docs state that's how it works yeah. I guess they aren't backticks in Delphi, rather they're "single colons", though, looking at it again, not that it matters that much. But yeah the docs say you need three of them on each side, and neither the opening or closing set can be directly followed by text on the same line. Which as you obviously know, isn't how my version works / worked.

Reply by email

Ben Grasset
to Michael Van Canneyt: I implemented the Delphi version in pas2js as well meanwhile (on demand), So both work. I…

On Sun, Dec 22, 2024 at 5:04 AM Michael Van Canneyt via fpc-devel <

Show quoted text 41 lines
wrote: On Sat, 21 Dec 2024, Ben Grasset via fpc-devel wrote: > Facts: > - Michael VC did not originally like the entire idea at all, if I recall > correctly. However, he eventually added an implementation of it to Pas2JS > that works literally the exact same as my main FPC compiler one does. > - Delphi (in the time since, as of version 12 I guess) has added this > themselves. Their version is not quite the same (frankly in my opinion, > theirs is overall worse than mine, for reasons such as the fact you HAVE to > put the closing backticks of a multiline string on their own entire line in > Delphi, whereas in my version the closing backticks could appear anywhere > and be parsed correctly. And so on and so forth). > > I'm as ready as I was several years ago to put this in main FPC if it'll be > accepted, however, would people want me to now imitate the Delphi > version (which again did not exist when I originally implemented the > functionality for FPC, and again is functionally different from both the > unmerged main compiler impl of mine and Michael VCs identical > actually-existing impl for Pas2JS). I implemented the Delphi version in pas2js as well meanwhile (on demand), So both work. I personally prefer the backtick version, it is easier to use. but nothing prevents us from having both as in pas2js. The implementation can be orthogonal. If you can change your implementation to actually support both ways, then I'll make sure it is merged in the FPC compiler. Michael. _______________________________________________ fpc-devel maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Got it. Thanks Michael. I've just replied to your email also.

Reply by email