Address initial comments and suggestions from code review by @rlim.
Make Scope.member constant-time instead of linear in the number of declarations.