21 Oct 2011 16:43
for-must-match
Continuing with our experimental syntax changes to improve the reliability of E, here's a patch that adds a "for-must-match" feature. http://gitorious.org/~tal-itinnov/repo-roscidus/it-innovation/commit/3ad4f5c3072447647c617fdb56738bf929cb8a1a (see also: http://wiki.erights.org/wiki/Surprise_list) Normally in E, this silently skips the third item: for a:int in [1, 2, "hi"] { println(a) } Now, it throws an exception: pragma.enable("for-must-match") for a:int in [1, 2, "hi"] { println(a) } To make a loop that skips non-matching items as before, use the "match" keyword. e.g. pragma.enable("for-must-match") for match a:int in [1, 2, "hi"] { println(a) }(Continue reading)
RSS Feed