I didn't realize the chain of restrictions involving global/const/immutable, so I think that option is out.

I tried using the delegate function you recommended. Your example with passing a string worked. Then I tried to mass my custom struct RequestPass, stored in m_pass. These lines of code:

m_pass.bks = new CassaClient("127.0.0.1", 9042, "bolt");

router.get(m_subPath ~ "register", (req, res) => bolt.views.user.register(req, res, m_pass));

yielded this error:

source/bolt/bolt.d(77): Error: need 'this' for 'm_pass' of type 'RequestPass'

Replacing m_pass with this.m_pass yielded the exact same error. I'm not sure what to do differently. I thought it might be clever to try this

auto pass = &m_pass;
router.get(m_subPath ~ "register", (req, res) => bolt.views.user.register(req, res, *pass));

Which left me with this error.

source/bolt/bolt.d(80): Error: function bolt.bolt.Bolt.register.__lambda2 cannot access frame of function bolt.bolt.Bolt.register

I've tried many of times to write a delegate function out, but I keep failing. I feel like I need something like the following:

void delegate() dg = bolt.views.user.register(req, res, m_pass);

, or

auto dg = &bolt.views.user.register;

But my Bolt class has no access to req or res, so far as I can tell.. and my register function requires req and res.. so I've dropped that for the time being.

Now, I happened across a thing such as mixin(import("user.d")) which is less elegant, but would work great for me. But I'm getting this error for relative and absolute paths to files:

source/bolt/bolt.d(109): Error: file "user.d" cannot be found or not in a path specified with -J