Recent

Author Topic: If you've ever wanted to be able to use multi-line strings in FPC...  (Read 29682 times)

PascalDragon

  • Hero Member
  • *****
  • Posts: 5444
  • Compiler Developer
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #105 on: July 20, 2019, 10:42:49 pm »
I wonder if all latin keyboards even have this character.
It's an ASCII character and thus it's very likely that all keyboards have it available somewhere.

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #106 on: July 20, 2019, 10:48:15 pm »
Beside the different internationale keyboard layouts:

The backtick is eye powder! Not everyone has good eyes. Or a monster screen!

Winni

VTwin

  • Hero Member
  • *****
  • Posts: 1215
  • Former Turbo Pascal 3 user
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #107 on: July 20, 2019, 11:04:11 pm »
The problem is "/" is not a new operator, it is currently used to indicate division and it is legal, though it would look a bit strange, to define division between two strings. There is nothing stopping/preventing a programmer from doing that which would cause an ambiguity, i.e, is it a division or a line continuation ?.
The same holds for "+".
Because the "+" operator is already used, thus it's not far-fetched to use "/" as well.

What has "+" to do with strings? Well, it "adds" them together.
What has "/" to do with strings? It "devides" them to two lines.
Quite intuitive, I'd say.

Anyways, that was only a suggestion.

It makes sense to me. "/" is not defined as a string operator now, and, if desired, could be redefined. Anyway, I was just pointing out a simple option.
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 12.1: Lazarus 2.2.6 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 2.2.6 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.2.6 (64 bit on VBox)

Akira1364

  • Hero Member
  • *****
  • Posts: 561
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #108 on: July 21, 2019, 12:16:16 am »

I am surprised that, no one noticed that there is an old Pascal feature which gets broken with introducing these multiline strings -- until now, in Pascal sources, all trailing spaces at the end of each line have always been insignificant.
Introducing these multiline strings breaks this rule.


I'm sorry, but this makes no sense whatsoever. That is absolutely not an "old Pascal feature" or "rule" by any sense of the term (more like a random, insignificant detail that you're pointing out), nor is introducing multiline strings going to "break" anything.

The nature of trailing whitespace is just something that has literally been completely irrelevant in the past due to there being no common scenario where anyone would have any reason to think about it. Which is not going to change. It still doesn't matter at all outside the specific context of a multiline string.

Beside the different internationale keyboard layouts:

The backtick is eye powder! Not everyone has good eyes. Or a monster screen!

Winni

It's like, exactly the same size as the single-quote we've all been happily using for years (and will happily continue to use, as once again, it's not going anywhere.)
« Last Edit: July 21, 2019, 12:32:26 am by Akira1364 »

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #109 on: July 21, 2019, 12:30:18 am »
Quote
It's like, exactly the same size as the single-quote we've all been happily using for years (and will happily continue to use.)

Yes, but then we got two different types of fruit flies.

Winni

Akira1364

  • Hero Member
  • *****
  • Posts: 561
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #110 on: July 21, 2019, 12:35:37 am »
Yes, but then we got two different types of fruit flies.

This means absolutely nothing and proves no point to speak of, so... ok?

Sorry for getting a bit frustrated, but I quite frankly find the level of continued opposition to the entire concept of multi-line strings, despite the fact that I've gone way out of my way to address all of the reasonable concerns with them that I could, to be utterly mind-boggling.

It is an incredibly simplistic piece of functionality to add to the language (or more specifically, to add to FPC's implementation of the language) that is not going to have any negative impact whatsoever on anyone's existing workflow.

Some of the comments in this thread are far too uncannily similar to the ridiculous non-arguments I often hear from backwards-thinking Golang users about how generics are somehow guaranteed to "ruin Go" if ever added to it, for my tastes. (Ironically Go does however have multiline strings, BTW!)
« Last Edit: July 21, 2019, 01:26:08 am by Akira1364 »

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #111 on: July 21, 2019, 01:29:38 am »
@Akira1364

Ok, I got your point of view. Accepted.

It's just about the eye powder.

I've got bad eyes and glasses. I know the problem to distinguish the back tick and the apostroph from a lot of working with the bash. If it's your own stuff then you can avoid the problem, but if it's system stuff or from other person, I really have always to look twice what kind of nothing that is.

So - I just wanted to avoid that problem. Nothing more.

Winni
« Last Edit: July 21, 2019, 01:36:49 am by winni »

Akira1364

  • Hero Member
  • *****
  • Posts: 561
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #112 on: July 21, 2019, 01:37:32 am »
@Akira1364

Ok, I got your point of view. Accepted.

It's just about the eye powder.

I've got bad eyes and glasses. I know the problem to distinguish the back tick and the apostroph from a lot of working with the bash. If it's your own stuff then you can avoid the problem, but if it's system stuff or from other person, I really have always to look twice what kind of nothing that is.

So - I just wanted to avoid that problem. Nothing more.

Winni

Don't get me wrong: I totally understand the eyesight thing, if that's the case. I just do not believe that it is, by itself, a significant enough reason to be "universally against" the feature to the extent that it prevents everyone else on Earth from using it.

Do note also:

Once this functionality gets merged to FPC, I then intend to submit a patch I have for Lazarus SynEdit which makes it highlight multi-line strings much the way it does multi-line comments right now.
(Of course, I know not everyone uses Lazarus, but it's something.)

The overall point is though that the ideal "end-game" tooling-and-editor-wise means that it should be very obvious in all (or at least the strong majority of) cases what is and is not a multi-line string, when reading source files.
« Last Edit: July 21, 2019, 02:33:19 am by Akira1364 »

Zoran

  • Hero Member
  • *****
  • Posts: 1824
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #113 on: July 21, 2019, 02:35:30 am »
It's an ASCII character and thus it's very likely that all keyboards have it available somewhere.

Hah, really! I wouldn't expect this to be ascii.

Okay, being ascii is really a strong point for it
 However, it is very similar to single quote, which is used for "old style" string literals, so can't we use some other character instead? Perhaps tilde ("~" -- also ASCII)?


I am surprised that, no one noticed that there is an old Pascal feature which gets broken with introducing these multiline strings -- until now, in Pascal sources, all trailing spaces at the end of each line have always been insignificant.
Introducing these multiline strings breaks this rule.


I'm sorry, but this makes no sense whatsoever. That is absolutely not an "old Pascal feature" or "rule" by any sense of the term (more like a random, insignificant detail that you're pointing out), nor is introducing multiline strings going to "break" anything.


I am very surprised that you don't see that syntax which allows trailing spaces affects readability of code. These spaces are literally invisible, so how readable that can be?

Readability is an important language feature.

Some different syntax which would require some (visible) character to mark the end-of-line and continuation on the next line would be much better way to implement this.

Akira1364

  • Hero Member
  • *****
  • Posts: 561
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #114 on: July 21, 2019, 02:43:20 am »
Hah, really! I wouldn't expect this to be ascii.

...What? Of course it is. Character number 96.

Perhaps tilde ("~" -- also ASCII)?

Oh, so I can waste even more time arguing with all of the Nitpick McGees out there who would definitely be very vocal with regards to complaining about how "weird" it looks to them or whatever? Yeah, no thanks.

Again, this is a moot point, now, anyways: I have literally zero intention of making that kind of fundamental change at this stage. It's not gonna happen. I've based my implementation around what was discussed (at length!) on the mailing list, and that's how at the very least the core of it is going to stay.

I am very surprised that you don't see that syntax which allows trailing spaces affects readability of code. These spaces are literally invisible, so how readable that can be?

Readability is an important language feature.

Some different syntax which would require some (visible) character to mark the end-of-line and continuation on the next line would be much better way to implement this.

There is literally no connection between multi-line strings and any hypothetical reason you would have cared in the slightest about "invisible spaces" in the first place (which is, none I can think of.) I don't understand why you think this is significant at all, let alone something that profoundly "affects readability".
« Last Edit: July 21, 2019, 03:07:52 am by Akira1364 »

PascalDragon

  • Hero Member
  • *****
  • Posts: 5444
  • Compiler Developer
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #115 on: July 21, 2019, 10:11:43 am »

I am surprised that, no one noticed that there is an old Pascal feature which gets broken with introducing these multiline strings -- until now, in Pascal sources, all trailing spaces at the end of each line have always been insignificant.
Introducing these multiline strings breaks this rule.


I'm sorry, but this makes no sense whatsoever. That is absolutely not an "old Pascal feature" or "rule" by any sense of the term (more like a random, insignificant detail that you're pointing out), nor is introducing multiline strings going to "break" anything.


I am very surprised that you don't see that syntax which allows trailing spaces affects readability of code. These spaces are literally invisible, so how readable that can be?

Readability is an important language feature.
In Lazarus you can enable whitespace to be shown as most editors allow. It's also very useful to find out if a tab was smuggled in somewhere...

Some different syntax which would require some (visible) character to mark the end-of-line and continuation on the next line would be much better way to implement this.
That would prohibit another purpose of this feature: to be able to copy some piece of code (e.g. some SQL script) and insert it without having to worry about adjusting it (aside from maybe escaping backticks, but that would be necessary with apostrophe as well).

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #116 on: July 21, 2019, 10:24:22 am »
There is literally no connection between multi-line strings and any hypothetical reason you would have cared in the slightest about "invisible spaces" in the first place (which is, none I can think of.) I don't understand why you think this is significant at all, let alone something that profoundly "affects readability".

Imagine this situation:
Code: Pascal  [Select][+][-]
  1. MyString :=
  2.   'Some string that, for whatever reason.' + LF
  3.   '      needs                           ' + LF
  4.   ' to have all these spaces.            ';

As a multiline:
Code: Pascal  [Select][+][-]
  1. OtherString :=
  2.   `Some string that, for whatever reason.
  3.          needs                          
  4.     to have all these spaces.            `;

Will both strings be the same? And you have to recognize that the multiline string is much less readable (how many spaces are there?) than the standard one and runs the risk of some editor "pruning" the final spaces in the second and third lines.

So yeah, it's probably nitpicking and a not very common situation, but it exists and some people may think it's important, whatever you or I or anyone else thinks, so it's not unreasonable.

Of course, one could always answer;: "In those situations, use standard strings" :)
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

heejit

  • Full Member
  • ***
  • Posts: 245
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #117 on: July 21, 2019, 11:04:40 am »
I think these feature is very nice.

if any one has issue they should avoid using it.

But we should encourage people who contributing to FPC development.

More contribution to FPC means much much better PROGRAMMING LANGUAGE/PLATFORM
it benefit to EVERYONE.



Zoran

  • Hero Member
  • *****
  • Posts: 1824
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #118 on: July 21, 2019, 01:29:28 pm »
if any one has issue they should avoid using it.

Reading and understanding code (not only the code you had written yourself) is important.

Then, please understand that programming is not only writing new code, but also maintaining code.

So, please avoid arguments like "If you don't like it, don't use it".

Of course, one could always answer;: "In those situations, use standard strings" :)

Yes, I knew this "argument" was just about to appear. ;)

Zoran

  • Hero Member
  • *****
  • Posts: 1824
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #119 on: July 21, 2019, 01:38:49 pm »

Hah, really! I wouldn't expect this to be ascii.

...What? Of course it is. Character number 96.

I am sorry I hadn't checked that in the first place. As I already admitted, the fact that it is ASCII is a strong point for it.

Anyway, I'm still saying that it is too similar to single quote which is used for "old style" strings, but I also have to admit we don't have much ASCII chars that are not already part of Pascal syntax left.


Perhaps tilde ("~" -- also ASCII)?

Oh, so I can waste even more time arguing with all of the Nitpick McGees out there who would definitely be very vocal with regards to complaining about how "weird" it looks to them or whatever? Yeah, no thanks.

Again, this is a moot point, now, anyways: I have literally zero intention of making that kind of fundamental change at this stage. It's not gonna happen. I've based my implementation around what was discussed (at length!) on the mailing list, and that's how at the very least the core of it is going to stay.

Akira, there is no need for this tone. I want to say what I think, that is all.

You are the one who took the effort to implement this, so from the moment I entered this topic, I have understood quite well that it is you and the core team who will decide what syntax will enter the language, it won't be me.

And, I would expect that now is still not too late for some changes, but of course only if you and the core fpc team agree with my points; otherwise you just won't accept them.

Nevertheless, I think that this topic is the right place to say what I think about it.

 

TinyPortal © 2005-2018