On Sunday, November 11, 2012 22:30:06 Namespace wrote: > I think that the problem is the immutable modifier. Without > immutable(T) and immutable as method modifier it works fine too. > My question is: why?
It's because _val isn't immutable. It's an A, and you can't implicitly convert A to immutable A. So, neither opDot or get is useable with Unique!A. It would have to be immutable(Unique!(immutable A)) for it to work (since Unique must be immutable for them to be callable, and _val must be immutable A for it to be able to be returned from them. The reason that the get is blowing up is that you're using it with alias this, which then makes it so that you're trying to use get, which then fails, because the this reference isn't immutable, whereas you're not trying to use opDot, so the compiler doesn't complain. - Jonathan M Davis