implementing foreach.xxx, in progress