On Mon, Sep 27, 2004 at 02:50:03PM +0200, Henrik Grubbström (Lysator) @ Pike (-) developers forum wrote:
It is, but the semantics get strange, since y in the first case is a value, but in the second is an index.
the semantics are strange anyways, having ; in the second does not help a bit here. since having 3 arguments vs 2 is already a clear visual difference larger than ; vs ,
comparing foreach(x,y) with foreach(x;y;z) is as confusing as comparing foreach(x,y) with foreach(x,y,z)
it is probably better to introduce the user to foreach(x;y;z) and foreach(x;;z) and depreciate the old foreach(x,y) completely.
thoughts?
The difference in syntax also helps detecting bugs. cf:
what kind of bugs? i don't see the difference with foreach(x;y) foreach(x;y;) foreach(x;;y)
should i teach people to always use foreach(;;) and tell them that foreach(,) is old and may be phased out?
can we get a warning for foreach(,) into pike 7.7 and should we convert all uses in the pike source? (just say yes here, and in a boring night it might happen)
greetings, martin.