[fpc-pascal] Feature announcement: Dynamic array extensions

Maciej Izak hnb.code at gmail.com
Mon May 21 01:36:19 CEST 2018


2018-05-21 0:52 GMT+02:00 Sven Barth via fpc-pascal <
fpc-pascal at lists.freepascal.org>:

> The thing is that I can easily imagine the Delphi devs to be so stoned to
> use the "[...]" for static arrays inside dynamic arrays as well which could
> lead to constructs like the following because they forget that dynamic
> arrays could be part of static arrays as well:
>
> === code begin ===
>
> var
>   v: array[0..2] of array of array[0..2] of LongInt = ([[1, 2, 3], [4, 5,
> 6]], [], [[7, 8, 9]]);
>
> === code end ===
>
> Yes, I have absolutely no confidence in the Delphi developers.
>

Sometimes they have fantasy ^^. Don't underestimate them, I am sure they
can do something more unexpected ;) For NewPascal mode I see this like :

var
  v: array[0..2] of array of array[0..2] of LongInt = ([(1, 2, 3), (4, 5,
6)], [], [(7, 8, 9)]);


> I don't want to use a modeswitch for every tiny little bit of feature.
> What we could do however would be a modeswitch for a strict Delphi mode
> that prohibits extensions and code that does not work in Delphi (like
> global operators and global generic functions). This could be used for code
> that is shared with Delphi to avoid potentially breaking compilability with
> Delphi if one is mainly using FPC for testing.
>

IMO potentially breaking compatibility is better than lock/prohibition for
missing features in Delphi (or waiting for Delphi implementation).
Programmers are not stupid and most of Delphi users knows what Delphi have
and what can be potentially risky. We have tons of examples which should be
disabled in Delphi mode but it works for comfort. r39045 is for sure not
comfortable IMO without real important reason, but this is just my opinion.


> The gain is consistency with static array constants. You don't need to
> care about whether it's a dynamic array or a static one, you simply use the
> same syntax.
> Also what do you care about mode ObjFPC anyway? One purpose of the mode
> *is* that it can go a different route than those modes that copy existing
> implementations.
>

I am worried about all Pascal modes including ObjFPC and Delphi mode. :)

-- 
Best regards,
Maciej Izak
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20180521/d8c1005f/attachment.html>


More information about the fpc-pascal mailing list