Signals and Slots
Sean Kelly
sean at f4.ca
Fri Nov 3 08:57:29 PST 2006
Frits van Bommel wrote:
> Sean Kelly wrote:
>> Frits van Bommel wrote:
>>>
>>> If we replace this line by:
>>> { slots_idx--;
>>> dg = slots[slots_index];
>>> slots[slots_idx] = null;
>>> then we don't need to check for empty slots in emit():
>>> If slots.length == slots_idx, we can be sure the array is full.
>>>
>>> (Unless there's a requirement for the slots to be
>>> called in any particular order?)
>>
>> No, but the sequence may need to be modified while emit is processing.
>> Consider a slot that disconnects itself when it receives a signal. But
>
> Yeah, that can create some extra headaches, of course.
By the way, I only mentioned this because of the foreach restrictions on
modifying a sequence while it is being processed. If this restriction
were not present, your example would be fine as-is. There's also
probably a better way to handle this situation than what I outlined--it
was just an example :-)
Sean
More information about the Digitalmars-d
mailing list