Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread J. Gareth Moreton
On 04/07/2019 06:31, Sven Barth via fpc-devel wrote: Am 04.07.2019 um 01:57 schrieb J. Gareth Moreton: While I like the idea in principle, one thing that I'm a bit worried about is how whitespace is handled, like what counts for a leading or trailing space in the string when between lines,

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread J. Gareth Moreton
On 04/07/2019 06:34, Sven Barth via fpc-devel wrote: Am 04.07.2019 um 01:00 schrieb Marco van de Voort: Op 2019-07-03 om 20:43 schreef Michael Van Canneyt: But the main question is: do we actually want a multiline string ? As far as I am concerned, that question needs to be answered first,

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Sven Barth via fpc-devel
Am 04.07.2019 um 01:00 schrieb Marco van de Voort: Op 2019-07-03 om 20:43 schreef Michael Van Canneyt: But the main question is: do we actually want a multiline string ? As far as I am concerned, that question needs to be answered first, and for me personally the answer to that is still a

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Sven Barth via fpc-devel
Am 04.07.2019 um 01:57 schrieb J. Gareth Moreton: While I like the idea in principle, one thing that I'm a bit worried about is how whitespace is handled, like what counts for a leading or trailing space in the string when between lines, since Pascal parsers (and those for many other

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Sven Barth via fpc-devel
Am 04.07.2019 um 02:09 schrieb Martin Frb: On 04/07/2019 01:57, J. Gareth Moreton wrote:  Also, with the backtick suggestion, what should one do if they wish to include a control character (e.g. a linefeed) or the backtick character itself? answer := `Well, this for ``inline`` backticks

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Sven Barth via fpc-devel
Am 04.07.2019 um 00:21 schrieb Ryan Joseph: On Jul 3, 2019, at 5:48 PM, Sven Barth via fpc-devel wrote: In case case of readability: most cases of multi line string constants are likely to be embedded scripts (shaders, SQL, whatever) and thus the $INCLUDESTRING directive mentioned in the

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Sven Barth via fpc-devel
Am 04.07.2019 um 00:08 schrieb Ben Grasset: On Wed, Jul 3, 2019 at 5:48 PM Sven Barth via fpc-devel > wrote: I'm with Michael here: I see no *need* for a separate syntax for a multi line string.  I don't really think the suggested backtick way

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Ben Grasset
Ok, I actually got this working fairly easily (though I'm sure it's not perfect.) Here's what it looks like in Lazarus, with a patched SynEdit. Note how you can even "fold" it! The program pictured compiles, and runs the way you'd expect it to. Assembler output

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Ben Grasset
On Wed, Jul 3, 2019 at 7:57 PM J. Gareth Moreton wrote: > While I like the idea in principle, one thing that I'm a bit worried about > is how whitespace is handled, like what counts for a leading or trailing > space in the string when between lines, since Pascal parsers (and those for > many

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Martin Frb
On 04/07/2019 01:57, J. Gareth Moreton wrote:  Also, with the backtick suggestion, what should one do if they wish to include a control character (e.g. a linefeed) or the backtick character itself? answer := `Well, this for ``inline`` backticks and ` + #9 + `this for other chars`;

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread J. Gareth Moreton
While I like the idea in principle, one thing that I'm a bit worried about is how whitespace is handled, like what counts for a leading or trailing space in the string when between lines, since Pascal parsers (and those for many other languages) traditionally, I believe, discard everything

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Ben Grasset
On Wed, Jul 3, 2019 at 7:32 PM Ryan Joseph wrote: > I don’t understand these objections either. Who says to themselves that > they explicitly want a language that doesn’t support multi-line comments or > strings? I use both of these all the time in PHP so it’s really hard to > understand why

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread John Doe
On Wed, Jul 3, 2019 at 4:20 PM Ben Grasset wrote: > const SA = ` > This is a multiline > string using hypothetical backticks. > Imagine it was fully syntax-highlighted > like normal strings and the comment > above are. > `; > That would be great to have! I've definitely wanted

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Ryan Joseph
> On Jul 3, 2019, at 7:22 PM, Ben Grasset wrote: > > Also goes for comments, but those have been in for a long time, so that > is a bit moot. > > It would be ridiculous if FPC did not support multi-line comments. > I don’t understand these objections either. Who says to themselves that

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Ben Grasset
On Wed, Jul 3, 2019 at 7:01 PM Marco van de Voort wrote: > Me too. Mostly overrated IMHO, and ugly as sin exception on general rules. > They're not overrated. There's very clear uses. As far as ugly, are you then saying that the "millions of addition operators" way is somehow less ugly? We're

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Ben Grasset
On Wed, Jul 3, 2019 at 7:11 PM Michael Thompson wrote: > Also +1, though I'm less enthused about the syntax highlighting. That's > icing. Multiline strings are what I'm focused on. > Well, the syntax highlighting is quite trivial to implement in SynHighlighterPas in the case of Lazarus. I was

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Michael Thompson
> const SA = ` > This is a multiline > string using hypothetical backticks. > Imagine it was fully syntax-highlighted > like normal strings and the comment > above are. > `; Also +1, though I'm less enthused about the syntax highlighting. That's icing. Multiline strings are what I'm

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Marco van de Voort
Op 2019-07-03 om 20:43 schreef Michael Van Canneyt: But the main question is: do we actually want a multiline string ? As far as I am concerned, that question needs to be answered first, and for me personally the answer to that is still a resounding "no". Me too. Mostly overrated IMHO, and

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Ben Grasset
Also: On Wed, Jul 3, 2019 at 5:50 PM Sven Barth via fpc-devel < fpc-devel@lists.freepascal.org> wrote: > There are are also still open questions regarding string encoding and > such. Those are issues that don't exist with something that is just a part of the compiler's existing ability to

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Ryan Joseph
> On Jul 3, 2019, at 5:48 PM, Sven Barth via fpc-devel > wrote: > > In case case of readability: most cases of multi line string constants are > likely to be embedded scripts (shaders, SQL, whatever) and thus the > $INCLUDESTRING directive mentioned in the bug report is much more useable,

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Ben Grasset
On Wed, Jul 3, 2019 at 5:48 PM Sven Barth via fpc-devel < fpc-devel@lists.freepascal.org> wrote: > I'm with Michael here: I see no *need* for a separate syntax for a multi > line string. > I don't really think the suggested backtick way is different enough from anything that exists to be

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Sven Barth via fpc-devel
Am 03.07.2019 um 20:55 schrieb Ryan Joseph: On Jul 3, 2019, at 2:43 PM, Michael Van Canneyt wrote: There is also still: https://bugs.freepascal.org/view.php?id=25536 What does this do and why has it been sitting there since 2014 if it’s useful? There are also still open questions regarding

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Sven Barth via fpc-devel
Am 03.07.2019 um 22:20 schrieb Ben Grasset: On Wed, Jul 3, 2019 at 3:27 PM gabor > wrote: I am also against this program Example; (*   This is a perfectly   normal multi-line   Pascal comment. *) const SA = `   This is a multiline   string using hypothetical

Re: [fpc-devel] [Suggestion] Enumeration range-check intrinsic

2019-07-03 Thread J. Gareth Moreton
So is the "(Value as TEnumType)" and "if (Value is TEnumType)" acceptable solutions to do a range check then the programmer absolutely needs it?  What do the administrators feel?  Not to be the bearer of bad news, but I feel like there's some disagreement. Note that things like the range

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Ben Grasset
On Wed, Jul 3, 2019 at 4:28 PM gabor wrote: > What is the end-of-line character in this case? #13#10, #10 or #13? It's whatever the EOL characters in that physical copy of the source file actually are. For example, currently #13 and #10 directly result in the "string exceeds end of line"

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Marcos Douglas B. Santos
On Wed, Jul 3, 2019 at 5:20 PM Ben Grasset wrote: > > On Wed, Jul 3, 2019 at 3:27 PM gabor wrote: >> > [...] > const SA = ` > This is a multiline > string using hypothetical backticks. > Imagine it was fully syntax-highlighted > like normal strings and the comment > above are. > `; >

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread gabor
W dniu 2019-07-03 o 22:20, Ben Grasset pisze: const SA = `   This is a multiline   string using hypothetical backticks.   Imagine it was fully syntax-highlighted   like normal strings and the comment   above are. `; What is the end-of-line character in this case? #13#10, #10 or #13?

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Ben Grasset
On Wed, Jul 3, 2019 at 3:27 PM gabor wrote: > I am also against this program Example; (* This is a perfectly normal multi-line Pascal comment. *) const SA = ` This is a multiline string using hypothetical backticks. Imagine it was fully syntax-highlighted like normal strings

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread gabor
W dniu 2019-07-03 o 21:39, Michael Van Canneyt pisze: See the bugreport I indicated. Michael. Ah, I missed that... So this is a popular idea. Regards, Michał. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Ben Grasset
On Wed, Jul 3, 2019 at 2:43 PM Michael Van Canneyt wrote: > But the main question is: do we actually want a multiline string ? > As far as I am concerned, that question needs to be answered first, and for > me personally the answer to that is still a resounding "no". > Why, though? What makes

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Michael Van Canneyt
On Wed, 3 Jul 2019, Ryan Joseph wrote: On Jul 3, 2019, at 2:43 PM, Michael Van Canneyt wrote: There is also still: https://bugs.freepascal.org/view.php?id=25536 What does this do and why has it been sitting there since 2014 if it’s useful? Because none of the compiler devs finds time

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Michael Van Canneyt
On Wed, 3 Jul 2019, gabor wrote: W dniu 2019-07-03 o 20:43, Michael Van Canneyt pisze: But the main question is: do we actually want a multiline string ? As far as I am concerned, that question needs to be answered first, and for me personally the answer to that is still a resounding "no".

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread gabor
W dniu 2019-07-03 o 20:43, Michael Van Canneyt pisze: But the main question is: do we actually want a multiline string ? As far as I am concerned, that question needs to be answered first, and for me personally the answer to that is still a resounding "no". I am also against this, but on the

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Ryan Joseph
> On Jul 3, 2019, at 2:43 PM, Michael Van Canneyt > wrote: > > There is also still: > https://bugs.freepascal.org/view.php?id=25536 What does this do and why has it been sitting there since 2014 if it’s useful? Regards, Ryan Joseph ___

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Ryan Joseph
> On Jul 3, 2019, at 2:43 PM, Michael Van Canneyt > wrote: > > But the main question is: do we actually want a multiline string ? As far as > I am concerned, that question needs to be answered first, and for > me personally the answer to that is still a resounding "no". I would use it for

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Michael Van Canneyt
On Wed, 3 Jul 2019, Ryan Joseph wrote: On Jul 3, 2019, at 12:53 PM, Ben Grasset wrote: After thinking about it more though I think Michael's backtick suggestion might actually be the best way to go, because of the fact that backticks currently have no meaning at all in Pascal, and as

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread wkitty42
On 7/3/19 12:53 PM, Ben Grasset wrote: On Wed, Jul 3, 2019 at 10:22 AM Marcus Sackrow wrote: I use an operator overload(not for constants but inside the code) because I'm used to our script engine have the '/' as operator for strings as line break. That's certainly a neat use of

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Ryan Joseph
> On Jul 3, 2019, at 12:53 PM, Ben Grasset wrote: > > After thinking about it more though I think Michael's backtick suggestion > might actually be the best way to go, because of the fact that backticks > currently have no meaning at all in Pascal, and as such, the compiler could > safely

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Marcus Sackrow
Am 03.07.19 um 18:53 schrieb Ben Grasset: On Wed, Jul 3, 2019 at 10:22 AM Marcus Sackrow mailto:al...@web.de>> wrote: I use an operator overload(not for constants but inside the code) because I'm used to our script engine have the '/' as operator for strings as line break. That's

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Ben Grasset
On Wed, Jul 3, 2019 at 10:22 AM Marcus Sackrow wrote: > I use an operator overload(not for constants but inside the code) > because I'm used to our script engine have the '/' as operator for > strings as line break. > That's certainly a neat use of operator overloading! However, I think that it

Re: [fpc-devel] [Suggestion] Enumeration range-check intrinsic

2019-07-03 Thread Sven Barth via fpc-devel
Ben Grasset schrieb am Mi., 3. Juli 2019, 18:00: > On Tue, Jul 2, 2019 at 7:38 PM Ondrej Pokorny wrote: > >> A good real-word example is the cast from a pointer: >> >> program Project1; >> uses Classes; >> var >>Value: TPersistent; >>P: Pointer; >> begin >>P := TObject.Create; >>

Re: [fpc-devel] [Suggestion] Enumeration range-check intrinsic

2019-07-03 Thread J. Gareth Moreton
Sometimes I can be too passionate for my own good, and I want FPC to continue being a great tool, without problems that prove to be a game-breaker. I would like to continue working on this particular issue and hopefully find an answer that everyone is happy with.  There are ways that an

Re: [fpc-devel] [Suggestion] Enumeration range-check intrinsic

2019-07-03 Thread Ben Grasset
On Tue, Jul 2, 2019 at 7:38 PM Ondrej Pokorny wrote: > A good real-word example is the cast from a pointer: > > program Project1; > uses Classes; > var >Value: TPersistent; >P: Pointer; > begin >P := TObject.Create; >Value := TPersistent(P); >if Value is TPersistent then >

Re: [fpc-devel] [Suggestion] Enumeration range-check intrinsic

2019-07-03 Thread Tomas Hajny
On 2019-07-03 08:58, Ondrej Pokorny wrote: Hi, If you want to extend -CR to perform "integer as enum" on enum(integer), please do it consequently and perform "integer as ShortInt" also on ShortInt(integer) - do range checking on explicit typecasts for all simple types, not only enums. People

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Marcus Sackrow
Am 03.07.2019 um 15:29 schrieb Ben Grasset: This has been discussed I think several times in the past, but I thought I'd bring it up once more as it has never made sense to me that FPC happily supports multi-line *comments* of any length, while having no such multi-line equivalent for string

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Ben Grasset
On Wed, Jul 3, 2019 at 9:34 AM Michael Van Canneyt wrote: > If multiline string support ever makes it into FPC, I hope it will be > simpler, with a backtick character: ` > I mean, I'd be fine with that also, if it was generally considered a better way of doing it.

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Ben Grasset
On Wed, Jul 3, 2019 at 9:29 AM Ben Grasset wrote: > const SingleLineString = > That one was supposed to also say "const MultiLineString = ". ___ fpc-devel maillist - fpc-devel@lists.freepascal.org

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Michael Van Canneyt
On Wed, 3 Jul 2019, Ben Grasset wrote: This has been discussed I think several times in the past, but I thought I'd bring it up once more as it has never made sense to me that FPC happily supports multi-line *comments* of any length, while having no such multi-line equivalent for string

Re: [fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Ben Grasset
On Wed, Jul 3, 2019 at 9:29 AM Ben Grasset wrote: > classic round-bracket-plus-apostrophe multi-line-Pascal-comment syntax. > I meant "round-bracket-plus-asterisk" here, of course. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org

[fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

2019-07-03 Thread Ben Grasset
This has been discussed I think several times in the past, but I thought I'd bring it up once more as it has never made sense to me that FPC happily supports multi-line *comments* of any length, while having no such multi-line equivalent for string literals. I was fiddling around with what the

Re: [fpc-devel] atomic reads and writes, was: "Maybe Gareth can be convinced to spend his energy on this ... "

2019-07-03 Thread George Bakhtadze
Hello, > btw, how would you do that if it is in not guaranteed? especially on arm There are memory barriers in FPC: ReadBarrier, WriteBarrier etc.I didn't investigate it but probably these barriers are for CPU only - gives guarantee that load/store operations are finished and thus you can rely on

Re: [fpc-devel] [Suggestion] Enumeration range-check intrinsic

2019-07-03 Thread Ondrej Pokorny
On 03.07.2019 02:37, J. Gareth Moreton wrote: On 03/07/2019 01:13, Ondrej Pokorny wrote: On 02.07.2019 23:34, Jonas Maebe wrote: As to your patch itself: why do you not directly compare the tconstexprint values directly, and use the svalue/uvalue fields instead? Because I missed that they

Re: [fpc-devel] [Suggestion] Enumeration range-check intrinsic

2019-07-03 Thread Ondrej Pokorny
On 02.07.2019 23:34, Jonas Maebe wrote: Invalid data means undefined behaviour, always. "is" is not a special case that is immune to this. Don't you really see the need to handle invalid data with a /defined/ behavior? Enum and subrange types /can/ store invalid data and they /do/ store

Re: [fpc-devel] [Suggestion] Enumeration range-check intrinsic

2019-07-03 Thread Ondrej Pokorny
On 03.07.2019 08:58, Ondrej Pokorny wrote: BTW I was always convinced that an explicit typecast switches off range checking. And now I open the documentation https://www.freepascal.org/docs-html/prog/progsu65.html and I read this: (citation) /If, at run-time, an index or enumeration type is

Re: [fpc-devel] [Suggestion] Enumeration range-check intrinsic

2019-07-03 Thread Ondrej Pokorny
On 02.07.2019 23:34, Jonas Maebe wrote: On 02/07/2019 22:31, Ondrej Pokorny wrote: This is similar to the object-is operator that gets evaluated as well even if the type of the left-side value is the type at right side: var   Value: TPersistent; begin   Value := TPersistent(TObject.Create);