On Sat, Jan 26, 2013 at 7:10 AM, Mark Morgan Lloyd <markmll.fpc-de...@telemetry.co.uk> wrote: > However, I'd suggest that there are two possible category of extension: > those that implement a clearly-delimited first-class object with interesting > properties, and those that don't. > > Something like a <generic>, or a /regular expression/ (borrowing from Perl), > or a [list of elements] fall into the first category, and should be > comparatively easy to add to a language- and for a user to ignore if he > doesn't like them. I disagree with the statement that generics are easy to add. I disagree with a statement that adding Perl's first-class regexp syntax is a good idea at all -- talk about messy parsing :) I agree that [list of elements] is a good feature, but it is already present. So, unfortunately, I can not accept your list as an example of "good" extensions.
> Something like >>>>> for v in a index i do > falls squarely into the latter category: it's messy to parse, worse to read, I disagree with the statement that "for-in-index" loop is "messy to parse". You can look at the code provided by Vasily: there is no problem in parsing at all. The question of readabllity is indeed subjective, and I am quite open for altervative proposals here. The current syntax was chosen based on the requirements to avoid new keywords and traditional Pascal preference for keywords over punctuation. However, I may consider variants below (v = value, i = index, a = array): for v, i in a do for i, v in a do // most similar to Python for (v, i) in a do for v[i] in a do for v index i in a do // perhaps this is really better -- I am not sure for index i in a do // we may allow to omit the value and loop only over the index -- this could be useful for STL sets for v key i in a do // new keyword = bad > and is completely unlike any existing language idioms. Do you mean idioms existing in Pascal, or general language idioms? -- Alexander S. Klenin _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel