[fpc-pascal] Food for thought - language string improvement
Sven Barth
pascaldragon at googlemail.com
Thu Jul 6 21:47:01 CEST 2017
On 06.07.2017 16:13, Graeme Geldenhuys wrote:
> Imagine if FPC had type inference and multi-line strings, neither very
> exotic features. The code then becomes:
>
> =========================================
> var query := '''SELECT Customers.CustomerName, Orders.OrderID
> FROM Customers
> FULL OUTER JOIN Orders
> ON Customers.CustomerID = Orders.CustomerID
> ORDER BY Customers.CustomerName;'''
>
> FDQuery1.SQL.Add(query);
> =========================================
>
>
> Easier to read, easier to edit, no need for a IDE wizard or external tools.
Completely ignoring the type inference which I'm definitely not a fan of
- at least not in Pascal: In my opinion it would be better to improve
and finalize the $IncludeStringFile patch from issue #25536 (
https://bugs.freepascal.org/view.php?id=25536 ).
It has the advantage that it doesn't change the language and that the
include file can be viewed independently with an appropriate syntax
highlighter (especially with more complex SQL statements - to stick with
your example - that is something that I'd really welcome).
Of course it has the disadvantage that one can't easily add variables,
but for things like this one can always pass the included string to
Format() and friends which in my opinion would be more cleaned up anyway.
Regards,
Sven
More information about the fpc-pascal
mailing list