On Sat, Jan 26, 2013 at 10:34 PM, Michael Van Canneyt <mich...@freepascal.org> wrote: > But if I must choose between > > for a,b in c do > > (with C a tuple enumerator/iterator) or > > for a in c index b do > > Then the former is ten times (well, a lot) better. > > So if someone were to introduce that to solve the original poster's problem, > you will not hear me protesting, it will have been well worth the energy I > put in this discussion. >
There are two reasons I proposed latter instead of former: 1) I think using keyword is more explicit and readable 2) I thought that smaller feature is easier to argue for than a large one -- apparently, I was mistaken on that :) So, amended "for-in-index" proposal: 1) The syntax is for value, key in container do ... 2) The enumerator interface is extended with optional property CurrentWithKey: TValueKey; where TValueKey must be a record with two fields. This property will be called in the case of two-argument for-in, while the case of single-argument for-in continues to work as-is for both compatibility and efficiency. 3) When/if the full tuple proposal gets implemented, "for-in-index", now aka "for-key-in", will became a proper subset of it. What do you think? -- Alexander S. Klenin _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel