On Thu, 04 Jun 2015 03:32:21 GMT, David Monagle wrote:

We have a largish app, with quite a few endpoints. I would really like to write the @auth methods once and reuse them throughout the application. The above code (when not attempting to access the session variable results in an error:

../../source/vibe/internal/meta/funcattr.d(189): Error: this for ensureAuth needs to be type BaseService not type InputAttribute!(ensureAuth)

This seems to come about purely because the definitions are in the parent class. Is there any way to achieve the simplicity of defining these filters once and using them many times? I'm sure I could do it with a mixin, but that would seem rather inefficient.

Cheers!

I'm not very familiar with the web interface, but given you code and the error message, I'd say, make it a mixin template instead of an inheritance.
Why would it be inefficient with a mixin ? Unless you're refering to string mixins ?
IMO, mixin template + final class might even give you a little more performance.