2018-05-20 20:44 GMT+02:00 Sven Barth via fpc-pascal <
fpc-pascal@lists.freepascal.org>:

> Anthony Walter <sys...@gmail.com> schrieb am So., 20. Mai 2018, 19:09:
>
>> By the way, what's the reason for differences in () / [] syntax between
>> objpas and delphi mode?
>>
>
> For the non-Delphi modes I decided to keep consistency with static array
> constants (which use the same syntax in Delphi btw!). For the Delphi modes
> I followed what Delphi does. And for some reason the Delphi devs thought it
> better to use a different syntax than that for static arrays. 🤷‍♀️
>

Gratz, seems that I will need to update NewPascal soon to get this fresh
feature :).

They decide for [] probably because it is similar syntax like for open
arrays. IMO "[]" syntax has more dynamic meaning/nature so looks more
proper for this feature (as you said "()" syntax is used for static
arrays), but this is probably individual taste.

"[]" also might be better for something like this :

var
  f: array of TSomeRec = [(a: 10; b: ['1', '2']), (a: 20; b: ['6'])];

instead of

var
  f: array of TSomeRec = ((a: 10; b: ('1', '2')), (a: 20; b: ('6')));

The main gain of different syntax between Delphi and ObjFpc is more
troubles for Pascal Programmers. :(

Why you decide to prohibit static array constants inside dynamic array
constants for Delphi modes in r39045? I do not understand this decision. It
is some punishment for using Delphi mode? -,- IMO bad decision.

For the consequence the following code

var
  f: array of TSomeRec = [(a: 10; b: ['1', '2']), (a: 20; b: ['6'])];

should be also prohibited in Delphi mode, because it not works in Delphi
like static array constants inside dynamic array constants...

-- 
Best regards,
Maciej Izak
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to