This is my reasoning: we should lookup for resources' defaults starting from the scope where the resource is instantiated, for example:
```
Xyz { scope => 'top' }
xyz { 'top': }
node 'example.com' { 
  Xyz { scope => 'example' }
  xyz { 'example': }
}
node 'other.com' {
  xyz {'other': }
}
```
then 
- `getparamdefault(Xyz[example], scope)` should return `'example'`,
- `getparamdefault(Xyz[other], scope)` should return `'top'`, and
- `getparamdefault(Xyz[top], scope)` should return `'top'`.

The resould shouldn't depend on the compiler's context (for a particular resource instance). The `resource.scope.lookupdefaults()` yields expected results.

For types, we have slightly different scoping rules. In the following example 
```
Xyz { scope => 'top'}
node 'example.com' { Xyz { scope => 'example' }}
node 'other.com' { }
```
`getparamdefault(Xyz, scope)` should return 'example` when compiler works for `example.com` node,  or `top`  when the compiler works for `other.com` of for any other. The invocation `lookupdefaults()` as in line 37 uses compiler's scope.

A few more examples may be found in specs.