You're right; recursion is a problem. Leaving the field typed as `Plan` and using a typeassert seems like right thing to do, but ideally the typeassert would involve a concrete type. Assuming you can implement `pinv_type` function, you could use:

```julia
pinv(p::Plan) = isdefined(p, :pinv) ? (p.pinv::pinv_type(p)) : (p.pinv = pinv(p))
```