On Thursday, 19 December 2013 at 11:22:59 UTC, Maxim Fomin wrote:
On Thursday, 19 December 2013 at 07:31:28 UTC, ilya-stromberg wrote:
What should we do if we decide that we need REAL `const` postblit/constructor? I mean postblit/constructor that creates only `const` object that can't be implicitly converted to the `mutable` or `immutable`.

D is not C/C++. Objects are either mutable or immutable. Sometimes you can view any of them through const. There are no const objects per se.

Yes, I know. The `const` type means that I don't know at compile time real object type: it can be `mutable` or `immutable` type. I can use `const` postblit/constructor to mark object. It lets me know the real object type at the run time and provide additional optimisations. So, it's a kind of dynamic typing.
See also example here:
http://forum.dlang.org/thread/[email protected]?page=5#post-pakelxyollnwvewuxajo:40forum.dlang.org

Reply via email to