[fpc-pascal] PAS2JS: operations with array of record
Sven Barth
pascaldragon at googlemail.com
Thu Jan 11 14:24:35 CET 2018
Am 11.01.2018 13:33 schrieb "Mattias Gaertner" <nc-gaertnma at netcologne.de>:
On Wed, 10 Jan 2018 11:40:48 -0700 (MST)
warleyalex via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
>[...]
> · Add(item [,...]) / Push(item [,...]) : increases Length by one and adds
one or more item at the end of the array, can also add arrays
(concatenation).
>
> · Clear() : empties the array (equivalent to SetLength(0))
>
> · Copy(startIndex[, count]) : creates a new dynamic array containing
count items from startIndex, if count isn't specified, copies to the end of
the array.
> [...]
There are the usual Pascal array functions, like setlength, copy, insert,
delete and concat.
You can also type cast the array to JSArray from unit js, which gives you
all the JS functions.
And when eventually type helpers are implemented, functions can be added to
Pascal arrays.
The problem with helper types is that you can't add them for all array
types at once, but only for a specific one (and even then - at least in
Delphi and FPC - you can't use "array of X", but need to use an explicit
array type).
Especially with the concept of type helpers already existing it makes sense
to think about "built in methods" for arrays...
Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20180111/436c2161/attachment.html>
More information about the fpc-pascal
mailing list