Expression caching

improved version of #9006 (which was an improved version of #8942)
yeah. this has always been this way. so i don't think that it's worth fixing right now.