Review of std.signal

Robert jfanatiker at gmx.at
Fri Jan 17 05:31:08 PST 2014


On Friday, 17 January 2014 at 08:46:33 UTC, Kagamin wrote:
> 1. there're two typical usage patterns of signals: you mostly 
> have 0 or 1 slots attached, so it would be nice if having one 
> slot wouldn't require allocation. SlotsArray should be probably 
> a tagged union of SlotImpl and SlotImpl[]. Is it worth an 
> effort?

Well it depends. One of my goals was to minimize memory usage of 
an empty signal, using a tagged union would increase the space 
used by an empty signal. (A slot consists of 3 pointers + memory 
for the tag, the array consists of a pointer and a length)

> 2. why InvisibleAddress is so big? Isn't it enough to just 
> negate it?

For 64 bit yes, but not for 32 bit. InvisibleAddress handles both.


> 3. I think, it's important to document, that a weak connection 
> can be destroyed before it becomes logically unneeded. It's an 
> important and non-trivial caveat.

How is this supposed to happen?


More information about the Digitalmars-d mailing list