Am 07.02.2016 12:51 schrieb "Michael Van Canneyt" <[email protected]>: > > > > 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.
Well... FPC is handling them special as well, after all we support open array parameters as well which clearly are no sets either. ;) They are parsed into an array constructor nodes and then converted into either an open array or a set by the node they're contained in. Support for normal arrays will simply(TM) mean the addition of additional special cases... (yes, it's easier said than done ;) ) Regards, Sven
-- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
