On Thursday, 14 June 2012 at 09:56:08 UTC, Roman D. Boiko wrote:
By the way, the whole data model is designed to be immutable.
Should I replace const with immutable then?
The other thing I don't like is having to cast everywhere:
struct Maybe(T)
{
immutable T* payload; // pointer to data
pure nothrow this(T* payload)
{
this.payload = cast(immutable) payload;
}
pure nothrow @property T front() const in{ assert(!empty); }
body{ return cast(T) *payload; }
//...
}
OTOH, I'm not sure making input parameter immutable would be
better for the user, same for function return type.