[fpc-pascal] Feature announcement: Dynamic array extensions

Sven Barth pascaldragon at googlemail.com
Mon May 21 10:12:47 CEST 2018


Am 21.05.2018 um 01:36 schrieb Maciej Izak:
> 2018-05-21 0:52 GMT+02:00 Sven Barth via fpc-pascal 
> <fpc-pascal at lists.freepascal.org 
> <mailto: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)]);

That is at least what I would *expect* for Delphi as well. And no, I'm 
definitely not underestimating their ability to come up with strange 
syntaxes... Do I do prefer not to think about it too much to avoid 
nightmares :P

>     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.

I've decided to lift the restriction again in r39078. Happy now?

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20180521/eb6c7dd2/attachment.html>


More information about the fpc-pascal mailing list