[fpc-pascal] Schema Types

Andrew Brunner andrew.t.brunner at gmail.com
Mon Dec 22 16:46:25 CET 2008


I would also add that it's wise to employ overloaded commands for each
data structure that contains dynamic arrays.  There may be nested
dynamic arrays, and Delphi at least would not respect copying over
nested data structures that contained Dynamic Arrays, so I write Copy,
Empty, SetSize routines for all my data types that contain dynamic
arrays.

I would like to point out that it would be nice if we could have lamda
expressions.  Does FPC already have this or is it planned?



On Mon, Dec 22, 2008 at 9:38 AM, Florian Klaempfl
<florian at freepascal.org> wrote:
> Jonas Maebe schrieb:
>>
>> One important different to keep in mind between dynamic arrays and regular
>> arrays (including those defined using schema types): dynamic arrays are
>> reference counted and copies are always shallow copies. This means that in
>> this code:
>>
>> var
>>  a, b: array of real;
>> begin
>>  setlength(a,10);
>>  b:=a;
>
> The proper way to do a copy is
> b:=copy(a);
> :)
>
> It's only a one level deep copy though.
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>



More information about the fpc-pascal mailing list