Dnia 18-10-2010 o 20:53:15 Steven Schveighoffer <[email protected]>
napisał(a):
On Mon, 18 Oct 2010 14:31:26 -0400, Tomek Sowiński <[email protected]> wrote:
Initializing immutable structures is a source of constant grief.
Anything non-trivial requires instancing a mutable structure,
initializing it, and then either casting to immutable (it's up to you
to ensure no alias leaked) or, not to violate the type system,
duplicate the whole.
Aren't we supposed to get so-called immutable constructors?
Haven't heard, can you point to the discussion?
Anyway, if these immutable ctors are defined inside the type, then the
library writer may not provide a ctor suitable for your case (very
possible).
Plus, if the thing I wrote is correct, why not?
If that's not what you mean, can you give an example of such grief?
Build an immutable dictionary that would hold the program's options.
I admit I don't use immutable structs/objects in day-to-day coding.
Some time ago I tried, swore loud, took hours to isolate & file several
bugs. But I'll try again, as soon as I get sufficient adrenaline lust. ;)
--
Tomek