[fpc-pascal] Feature announcement: Dynamic array extensions

Bernd Oppolzer bernd.oppolzer at t-online.de
Sun Jun 3 11:56:30 CEST 2018



Am 02.06.2018 um 15:14 schrieb Sven Barth via fpc-pascal:
> Mark Morgan Lloyd <markMLl.fpc-pascal at telemetry.co.uk 
> <mailto:markMLl.fpc-pascal at telemetry.co.uk>> schrieb am Sa., 2. Juni 
> 2018, 10:53:
>
>     However as Dennis points out + is also essential for vector
>     operations.
>     Perhaps either leaving it to the programmer to define what's needed
>     would be the best approach, or alternatively splitting dynamic arrays
>     into mathematical vectors and non-mathematical collections. Or
>     relaxing
>     the requirement that only predefined operators can be redefined,
>     so that
>     something like _ could be used for concatenation.
>
>
> That needlessly complicates the parser as the compiler still needs to 
> know them and they also need to be part of its operator precedence 
> rules. Don't complicate the language for nothing! And in the end 
> operator overloads are one of the best examples for syntactic sugar as 
> you can easily achieve the same result with functions and methods.
>
> Regards,
> Sven
>

This is somehow off topic of course,
but IMO it is strange to use + for string concatenation;
I always have bad feelings about this. This whole thread would
not exist, if FreePascal had gone another direction like PL/1, for example,
where the string concatenation operator is ||
(and DB2, and - probably - other SQL dialects).

Where does this + for string concat come from?

(Of course, || has some codepage issues, but that's another story,
and it means logical or in other languages ...)

BTW:

this is (part of) the input for the scanner generator
for the New Stanford Pascal compiler:

SYLPARENT := '(';

SYRPARENT := ')';

SYLBRACK := '[' OR '(.' OR '(/';

SYRBRACK := ']' OR '.)' OR '/)';

SYCOMMA := ',';

SYSEMICOLON  := ';';

SYARROW := '->' OR '@' OR '^';

SYPERIOD := '.';

SYDOTDOT := '..';

SYCOLON := ':';

SYPLUS := '+';

SYMINUS := '-';

SYMULT := '*';

SYSLASH := '/';

SYEQOP := '=';

SYNEOP := '<>';

SYGTOP := '>';

SYLTOP := '<';

SYGEOP := '>=';

SYLEOP := '<=';

SYOROP := '|';

SYANDOP := '&';

SYASSIGN := ':=';

SYCONCAT := '||';

if you want to change the representation of the symbols, you only change 
here.

Kind regards

Bernd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20180603/e958e21e/attachment.html>


More information about the fpc-pascal mailing list