Recent

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

jamie

  • Hero Member
  • *****
  • Posts: 2086
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #150 on: August 09, 2019, 04:13:33 pm »
as I stated before, I have a side tool I use since the days of Delphi and it also works in Lazarus that allows me to edit, save, put to clipboard, back from clipboard blocked text with all the standard string '+ etc...

 This tool also uses (optional) C escape text so that I can quickly build a pascal string with all the pascal methods of inserting special characters. It has two views the raw initial view and the final pascal view..

  I really think a tool like this should be in the LCL tools instead of the compiler, but who am I ? Just some code junky born and raised in the foot hills of Maine, USA where everyone is related! ;)
Number 1 at blue screen app creations!

SlightlyOutOfPhase

  • New Member
  • *
  • Posts: 33
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #151 on: August 10, 2019, 01:30:47 am »
I really don't see the point. It is already supported as many people explained.

No it's not. Not even close. The fact that there's anyone at all who would be "against" something like this is literally insane. It makes no sense.

Look at the stuff Akira does in his tests and tell me that's possible right now.
« Last Edit: August 10, 2019, 04:37:25 am by SlightlyOutOfPhase »

Thaddy

  • Hero Member
  • *****
  • Posts: 9184
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #152 on: August 10, 2019, 07:39:20 am »
For the record: I am not against it, but I really do not see the point.

I only take exception to code like this:
Code: Pascal  [Select]
  1. if (c in ['1'..'9']) then // <------ sigh
  2.           begin
  3.             count:=current_scanner.readval;
  4.             if (count<0) or (count>65535) then // <------- sigh some more
Both the range and the limit. See if you can spot what I mean  :o

In my view the functionality is already covered by the string helper in sysutils and without an artificial limit. Let alone the meaning of "word"..
In my subsequent view this should not be a compiler feature but a high level library feature. In that sense I consider this a design flaw, and I am not the only one.
« Last Edit: August 10, 2019, 07:55:30 am by Thaddy »
also related to equus asinus.

PascalDragon

  • Hero Member
  • *****
  • Posts: 673
  • Compiler Developer
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #153 on: August 10, 2019, 01:16:14 pm »
I only take exception to code like this:
Code: Pascal  [Select]
  1. if (c in ['1'..'9']) then // <------ sigh
  2.           begin
  3.             count:=current_scanner.readval;
  4.             if (count<0) or (count>65535) then // <------- sigh some more
Both the range and the limit. See if you can spot what I mean  :o

In my view the functionality is already covered by the string helper in sysutils and without an artificial limit. Let alone the meaning of "word"..
Okay, the range for c should start from '0' as other directives allow leading zeros as well, but that's all we're talking about here: detecting leading zeros. The complete number is read by readval.
And using High(Word) instead of the literal 65535 would indeed be nice as well.

That said there has been no decision yet whether we want to allow the use of helpers (or generics for that matter) inside the compiler. Also the string helper would be useless as a) the compiler uses mainly ShortString and b) there is no Char helper.

Thaddy

  • Hero Member
  • *****
  • Posts: 9184
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #154 on: August 10, 2019, 01:57:31 pm »
@Sven
You were not supposed to bite...
also related to equus asinus.

Akira1364

  • Hero Member
  • *****
  • Posts: 539
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #155 on: August 10, 2019, 05:45:41 pm »
I only take exception to code like this:

"c" is one character, Thaddy. (As in, the first character of what may or may not be a valid number.) "readval" then attempts to read an actual complete number into the "count" variable.

As far as this being provided by some kind of library, that would be strictly worse, as it would be slower and could not have the capabilities it does now. As far as TStringHelper being related to this kind of thing at all, I don't get what you mean.

Okay, the range for c should start from '0' as other directives allow leading zeros as well, but that's all we're talking about here: detecting leading zeros. The complete number is read by readval.
And using High(Word) instead of the literal 65535 would indeed be nice as well.

I'll make those changes.
« Last Edit: August 10, 2019, 05:48:37 pm by Akira1364 »

Zoran

  • Hero Member
  • *****
  • Posts: 1464
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #156 on: August 10, 2019, 05:55:58 pm »
This is a dirty feature.
Don't you understand -- in Pascal, trailing spaces at the end of a line have always been insignificant.

This is important -- trailing spaces are not visible.
You cannot see them! A programming language in which spaces in the end of line can be significant is not clean, as Pascal should be.

It is very bad.

Akira1364

  • Hero Member
  • *****
  • Posts: 539
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #157 on: August 10, 2019, 06:03:13 pm »
- snip -

Read my previous comment as to why I fundamentally disagree with you.

Thaddy

  • Hero Member
  • *****
  • Posts: 9184
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #158 on: August 10, 2019, 06:06:21 pm »
"c" is one character, Thaddy. (As in, the first character of what may or may not be a valid number.) "readval" then attempts to read an actual complete number into the "count" variable.
Well, Sven knew what I meant... :D
And as far as the helper goes, look at the interface. You can achieve the same  with few lines of code. (syshelph.inc)
also related to equus asinus.

Zoran

  • Hero Member
  • *****
  • Posts: 1464
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #159 on: August 10, 2019, 06:10:05 pm »
- snip -

Read my previous comment as to why I fundamentally disagree with you.

I read them, of course... Nevertheless, I still hope for a little common sense...

440bx

  • Hero Member
  • *****
  • Posts: 1199
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #160 on: August 10, 2019, 07:14:19 pm »
Nevertheless, I still hope for a little common sense...
What I'm going to state isn't associated with the feature being discussed here, just a truism which is, common sense is the least common of all senses.  (as clearly evidenced in a number of threads completely unrelated to this new feature.)


using FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

Akira1364

  • Hero Member
  • *****
  • Posts: 539
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #161 on: August 10, 2019, 07:50:59 pm »
Nevertheless, I still hope for a little common sense...

Right, as do I. There's mountains of evidence in various places (and various languages) as to how this kind of feature does not cause anything resembling kind of issues you're speculating about.

Also, as far as I know, my implementation of this actually goes farther than any other language's implementation does with regards to end-user customization and error handling in the case of "unterminated" multi-line strings.

ASBzone

  • Sr. Member
  • ****
  • Posts: 253
  • Automation leads to relaxation...
    • BrainWaveCC Utilities
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #162 on: August 11, 2019, 06:25:41 am »
This is a dirty feature.
Don't you understand -- in Pascal, trailing spaces at the end of a line have always been insignificant.
...


Perhaps I am missing something, but this feature doesn't change that at all.

For those who do not implement it, there is zero change to trailing space significance.


To those who implement the feature, there is zero change to trailing space significance.


If someone needs trailing spaces for a regular or multi-line string, then they have to pay attention to it for the strings in question, but it will not automatically affect every string.

-ASB: https://www.BrainWaveCC.com

Lazarus v2.0.5 r62023 / FPC v3.2.0-beta-r43192 (via FpcUpDeluxe) -- Windows 64-bit install w/32-bit cross-compile
Primary System: Windows 10 Pro x64, Version 1903 (Build 18362.418)
Other Systems: Windows 10 Pro x64, Version 1903 or greater

PascalDragon

  • Hero Member
  • *****
  • Posts: 673
  • Compiler Developer
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #163 on: August 11, 2019, 02:00:38 pm »
@Sven
You were not supposed to bite...
It's about compiler related code, so of course I'll bite. And Akira1364 said that he'd make some adjustments...
And as far as the helper goes, look at the interface. You can achieve the same  with few lines of code. (syshelph.inc)
I still don't get though what you're trying to get at with the helpers...

jshah

  • Full Member
  • ***
  • Posts: 182
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #164 on: September 14, 2019, 01:22:32 pm »
Is this FEATURE ACCEPTED BY CORE TEAM???