Changed ScopingRule to deal with scala scopes

After discussion with @Lewix, we realized we had no mechanism to deal with scala-style symbol scoping, so the ScopingRule base-type now provides symbol scoping functionalities.

I also extended the optimizer macro with ClassDef and ModuleDef since some rules were throwing warnings about this.
Let's make the return type `this.type`, so people can achieve what we had before in one expression:

```
enterScope().scope(elem)
```

While we're at it, I find `scope` confusing -- to me it's a noun, so how about `add`?