Constructing a class in-place

Petar Petar
Thu Jul 26 21:51:25 UTC 2018


On Thursday, 26 July 2018 at 21:22:45 UTC, Petar Kirov 
[ZombineDev] wrote:
> [..]
>
> D on the other hand is (or at least I'm hopeful that it is) 
> moving away giving magical powers to its runtime or standard 
> library and is its embracing the spirit of bare bones systems 
> programming where the programmer is allowed or even encouraged 
> to implement everything from scratch (cref -betterC) for when 
> that is the most sensible option.
> While C and C++ approach portability by abstracting the 
> machine, the approaches portability by laying all the cards on 
> the table and defining things, rather than letting them be 
> unspecified or at least documenting the implementation 
> definition.
>
> [..]

That is not too say that we shouldn't try to improve D's spec to 
allow more room for compiler optimizations (like the problem that 
you can't type instances of TypeInfo as fully read-only, because 
of the questionable feature of using them as an abundant pool of 
mutexes).
My point is that at least in the near term future, D compilers 
shouldn't try to assume they have monopoly (like there only one 
right way) on object lifetime, given that everybody in the 
community so to speak is busy making their own memory management 
scheme. Removing UBs in this area at the cost of limiting 
compiler optimizations will at least make the @nogc transition 
period smoother for everyone. Though I'm sure there's plenty of 
other opportunities for tightening the spec.


More information about the Digitalmars-d mailing list