Immutability and other attributes, please review

dennis luehring dl.soluz at gmx.net
Thu Jun 14 08:21:31 PDT 2012


Am 14.06.2012 15:26, schrieb Roman D. Boiko:
> But now, with everything immutable, I had to comment out several
> test cases. I cannot pass an immutable struct allocated on stack,
> into a method by reference, and then store a pointer to it,

thats sounds very evil - with or without immutable
how should that work anyway?

> because compiler says it is not an l-value. Should I allocate it
> on heap? Or get rid of functions taking parameter by ref, and use
> only those which take a pointer?

i would use the heap and ref - else you need to copy, the pointer would 
also not work if your struct is still in the stack - or does the stack 
live long enough?




More information about the Digitalmars-d-learn mailing list