On Sun, 08 Feb 2009 17:07:31 +0300, Weed <resume...@mail.ru> wrote:
Denis Koroskin пишет:
Your C objects have value semantics. For value semantics you should use
value types.
At present in D is not contain support of value types for objects.
(I consider that it is necessary)
Alternatively you may want to use the following trick (I used it for
lazy string concatenation in C+):
[skip]
Apparently, it doesn't work at the moment because ctor can't be a
template :(
Is there an enhancement request in bugzilla? It prevents this pattern
from working.
+ it is difficult and also it will be even more difficult if it will be
necessary to make support for the construction like:
space_ship_1.calculatePathTo("Moon").getCheckpoint(3).getCoords;
In this example we create a temporary class "path", create temporary
class "checkpoint" and we take coords of checkpoint of this path. It is
not expedient to us to store all this path and checkpoint because it is
vary.
(from
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=81432)
I believe you should stick with structs for that.