named arguments, string interpolation, please stop.

Siarhei Siamashka siarhei.siamashka at gmail.com
Thu Jan 11 22:40:52 UTC 2024


On Thursday, 11 January 2024 at 22:02:16 UTC, Adam Wilson wrote:
> [...]
> And what people really want to do is disable collections 
> because they don't like the collection pauses. They don't 
> *actually* care about the allocations per se because that is 
> generally as fast as a malloc

It is generally as *slow* as malloc.

> and they are going to have to allocate at some point anyways.

In many cases it's possible to write performance critical inner 
loops without any heap allocations at all. The `@nogc` attribute 
could work as a safeguard to ensure that *unnecessary* 
allocations are not happening if we don't expect them there. The 
compiler could be helpful and yet it isn't. That's your loss. And 
that's the reason why you have to deal with unhappy users.

> So @nogc works exactly as specified, but because of an 
> unspecified implementation side-effect, that is not guaranteed 
> to hold true in the future, the @nogc crowd writes their code 
> as if @nogc does something else entirely.  And we end up here 
> in this thread.

Please don't make any weird assumptions. I'm not telling you any 
new information and you are supposed to already know this since a 
very long time ago.


More information about the Digitalmars-d mailing list