[Lazarus] Can I assign items in an array all at once in FreePascal?

Michael Van Canneyt michael at freepascal.org
Sun Feb 7 12:51:54 CET 2016



On Sat, 6 Feb 2016, Sven Barth wrote:

>>
>> Because of 2 reasons:
>>
>> 1. Delphi introduced the create constructor.
>>
>> 2. A literal such as [10,20,30,40] is a set in pascal, not an array.
>
> The answer is no longer correct with current Delphi versions. It now is
> "because we haven't implemented it yet".

Indeed. Well, I'm still on XE, the jump to XE 10 is for next month.
Seems I'll have some reading up to do...

Disregarding the fact that they introduced now 2 syntaxes to initialize an
array, I'm curious what Jonas is going to say, because I remember he always 
advocates that the type of an expression is determined by the terms/factors 
in the expression, not by what you assign it to.

For
  ['abc','def'] + ['ghi','jkl']
it is more or less clear.

But what is the type of this expression:
  [1,2,3] +  [4,5,6]
is it an array or a set ?

It probably means that they regard [] always as an array, and added some
kind of automatic set-to-array type assignment compatiblity for types that 
somehow fit in a set.

Michael.




More information about the Lazarus mailing list