Med: make foreach_* macros use variable refs passed as arguments
...instead of accidentally stealing variables from the outter, lexical
scope, which only worked thanks to match on identifiers, and would get
ultimately broken on renaming them in respective lexical scopes.