Mihails Strasunson Stack Overflow • Recommends
On “When and how should I use `const` and `immutable` in D?”
You are extremely lucky - a video from DConf2013 with presentation devoted exactly to this topic has been published last week : link to this video
In your case, auto s = new immutable(S)(); should do the trick. You can then create data slice points to in constructor. However, if this slice may point to any data, then S can't possibly be immutable, because both const and immutable are transitive in D - they provide very strong guarantees not only about variable itself but also about any data that can be accessed from it indirectly via reference/pointer.
It is actually covered in linked video, but short summary is that you want to use immutable when really intend to. In other words, when you want you…