Recent

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

Awkward

  • Full Member
  • ***
  • Posts: 135
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #135 on: July 24, 2019, 08:13:29 am »
i not sure what this feature making pascal better and easier. at least coz many people uses editors which cut trailing spaces which can be part of these multiline strings. and it makes harder to recognize "occasional strings" when you just wrote wrong (quote) char. 100% we will got some new problems with existing editing frameworks if this thing will be implemented. I'm not against language changes but if it really helpfull, necessary and don't makes new problems. but not this case (anyway, it just my personal opinion)

Imants

  • Full Member
  • ***
  • Posts: 196
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #136 on: July 24, 2019, 08:47:30 am »
i not sure what this feature making pascal better and easier. at least coz many people uses editors which cut trailing spaces which can be part of these multiline strings. and it makes harder to recognize "occasional strings" when you just wrote wrong (quote) char. 100% we will got some new problems with existing editing frameworks if this thing will be implemented. I'm not against language changes but if it really helpfull, necessary and don't makes new problems. but not this case (anyway, it just my personal opinion)

Everything can make new problems but that is not reason to not go forward and evolve. Problems needs to be solved not run away from them!

This feature is like ages in c++ and python (c++ user R("text") and python uses """text""") and I do not see anybody bashing it. Even more this feature is widely used to write complex SQL-s in our code so that you can stop using annoying "'text' +" construction witch makes code harder to read and maintain. And am already testing testing this feature using Lazarus and it works quite nice. And yes there are some hiccups like if I write word "type" inside new construction Lazarus will protest that type can't be there. But still it is not reason to not implement this feature.

AFFRIZA 亜風実

  • Full Member
  • ***
  • Posts: 144
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #137 on: July 24, 2019, 08:52:46 am »
People like you are DIRECTLY what causes FPC's slow, inevitable decline in popularity. It's the same fucking thing every fucking time anybody wants to introduce anything new: a bunch of illiterate morons spouting off conspiracy-theory nonsense about how the sky is falling, who are ALWAYS, ALWAYS, ALWAYS clearly wrong in hindsight. You can go wayyyyy back on the developer mailing list for FPC and find people who unironically argued against the introduction of for-in loops the same fucking way you're arguing against this strings feature, back in like 2006. I'm not kidding. For-in loops! How fucking insane does that sound now that they've been a normal part of the language for years? Very!

So yeah, for the love of god stop fucking driving away smart people who both want to improve FPC and can also actually do the work themselves, or sometime real soon there won't be anyone left working on it at all.
Absolutely agree, absolutely.
« Last Edit: July 24, 2019, 08:55:16 am by Dio Affriza »
Kyoukai Framework: https://github.com/afuriza/kyoukai_framework

Dukung kemerdekaan Donetsk dan Lugansk! Tidak membalas profil berbendera biru-kuning apalagi ber-Bandera.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #138 on: July 24, 2019, 09:15:17 am »
i not sure what this feature making pascal better and easier. at least coz many people uses editors which cut trailing spaces which can be part of these multiline strings. and it makes harder to recognize "occasional strings" when you just wrote wrong (quote) char. 100% we will got some new problems with existing editing frameworks if this thing will be implemented. I'm not against language changes but if it really helpfull, necessary and don't makes new problems. but not this case (anyway, it just my personal opinion)
As Akira1364 wrote, there are already enough more critical features in Object Pascal that allows a user to shoot himself in the foot if they're not careful (and more spectacular as well). There are always ways to abuse or misuse a feature, so to simply use that to outweigh the potential uses of this feature feels like the easy way out.

avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #139 on: July 24, 2019, 09:31:49 am »
Came across another area today where I think multi-line strings would be quite helpful
Speaking of ideas, would something like this be possible eventually:
Code: Pascal  [Select][+][-]
  1. const
  2.    MultiLineTemplateStr = {$i '/codegen/template1.pas'};
where template1.pas would be regular pascal file without opening and closing multilinestring character at the beginning and end of file?

Of course, probably with something new replacing $i from given example.
« Last Edit: July 24, 2019, 09:36:24 am by avra »
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #140 on: July 24, 2019, 09:39:25 am »
Came across another area today where I think multi-line strings would be quite helpful
Speaking of ideas, would something like this be possible eventually:
Code: Pascal  [Select][+][-]
  1. const
  2.    MultiLineTemplateStr = {$i '/codegen/template1.pas'};
where template1.pas would be regular pascal file without opening and closing multilinestring character at the beginning and end of file?

Of course, probably with something new replacing $i from given example.
Look here.

avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #141 on: July 24, 2019, 10:01:53 am »
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

kupferstecher

  • Hero Member
  • *****
  • Posts: 583
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #142 on: July 24, 2019, 10:42:00 am »
One thing (I didn't test, perhaps it is already designed like that).

In my opinion the following two notations should result in the same string, i.e. in the same number of line breaks.

Code: Pascal  [Select][+][-]
  1. SomeString:=
  2. `First Line
  3. Second Line`;

Code: Pascal  [Select][+][-]
  1. SomeString2:=
  2. `
  3. First Line
  4. Second Line`;

This on the other hand should insert an additional line break:
Code: Pascal  [Select][+][-]
  1. SomeString3:=
  2. `
  3.  
  4. First Line
  5. Second Line`;

This means the first line break is ommitted in case the line containing the backtick is empty (no character following). Perhaps the same could be done with the closing backtick, but I'm not sure how useful this woud be. Pasting between "untouched" backticks would be possible, but it would be less intuitive to get a line break removed.

Akira1364

  • Hero Member
  • *****
  • Posts: 561
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #143 on: July 24, 2019, 06:30:00 pm »
i not sure what this feature making pascal better and easier. at least coz many people uses editors which cut trailing spaces which can be part of these multiline strings.

Think about it this way: the reason that so many editors remove trailing whitespace automatically is because pretty much nobody ever specifically wants trailing whitespace. It's something that most of the time just winds up as a part of the line accidentally, and that serves no purpose I can think of in the vast majority of cases other than to unnecessarily increase the file size of the document in question.

Also, to be clear, as I've said in earlier comments, as far as my implementation of multi-line strings for FPC goes the presence or non-presence of trailing whitespace does not affect them in any way you could physically notice unless you were actively checking to see if it was there.

And am already testing testing this feature using Lazarus and it works quite nice. And yes there are some hiccups like if I write word "type" inside new construction Lazarus will protest that type can't be there. But still it is not reason to not implement this feature.

Glad you like it! As far as the "type" thing: yes, that would be due to Lazarus "CodeTools" (which is separate from SynEdit, to be clear) not currently being aware of multi-line strings. I'm quite willing to (and probably will) work up a patch for it myself, but I don't see much point in spending a lot of time on it until the actual language feature is merged to FPC trunk.
« Last Edit: July 24, 2019, 07:31:32 pm by Akira1364 »

440bx

  • Hero Member
  • *****
  • Posts: 3946
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #144 on: August 04, 2019, 03:31:39 pm »
I don't see much point in spending a lot of time on it until the actual language feature is merged to FPC trunk.
Just curious... how is the "future" of that feature looking like ?... has a decision been made on whether or not it will eventually be added ?

(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Thaddy

  • Hero Member
  • *****
  • Posts: 14211
  • Probably until I exterminate Putin.
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #145 on: August 04, 2019, 06:22:54 pm »
My hunch is - and I would support that - a big no.
I really don't see the point. It is already supported as many people explained.
Specialize a type, not a var.

440bx

  • Hero Member
  • *****
  • Posts: 3946
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #146 on: August 04, 2019, 06:29:29 pm »
I really don't see the point.
That is no surprise.

It is already supported as many people explained.
You must be very happy driving your Model T, it supports everything a car is supposed to do. 
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Akira1364

  • Hero Member
  • *****
  • Posts: 561
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #147 on: August 09, 2019, 03:00:08 pm »
My hunch is - and I would support that - a big no.

If that was the case I think it would have been made much more explicit early on (rather than laying out requirements for it to be considered and even giving words of encouragement due to how quickly I implemented them, which is how things actually went.)

Either way I intend to keep the patch up to date, and maintain the open issue on the bugtracker for as long as it takes. I'm not going to "get bored" of waiting and forget about it after a while or anything like that.
« Last Edit: August 09, 2019, 03:05:57 pm by Akira1364 »

jamie

  • Hero Member
  • *****
  • Posts: 6091
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #148 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! ;)
The only true wisdom is knowing you know nothing

Thaddy

  • Hero Member
  • *****
  • Posts: 14211
  • Probably until I exterminate Putin.
Re: If you've ever wanted to be able to use multi-line strings in FPC...
« Reply #149 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 »
Specialize a type, not a var.

 

TinyPortal © 2005-2018