Old problem with performance

Weed resume755 at mail.ru
Sun Feb 8 06:07:31 PST 2009


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)



More information about the Digitalmars-d mailing list