www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - What is difference between std.signal and events?

reply "Uranuz" <neuranuz gmail.com> writes:
I have read some posts about new std.signal implementation. The 
last was this review thread: 
http://forum.dlang.org/thread/ujlhznaphepibgtpcoqz forum.dlang.org. 
What I still can't understand what is difference between signals 
and events in languages like JavaScript, C# and Borland C++ (that 
has it's own extension to language to implement events). As far 
as I understand in C# events are based on delegates but have some 
limitations. They can only be fired from owner's method. In JS 
events at my point of view are used to notify some input events 
or DOM changes. Borland C++ uses them to notify GUI events (in 
example button click). Is module called "signals" only for not 
interfere with OS IO events or is there some difference and 
reason?
Jan 16 2014
parent "Orvid King" <blah38621 gmail.com> writes:
On Thu, 16 Jan 2014 13:43:39 -0600, Uranuz <neuranuz gmail.com> wrote:

 I have read some posts about new std.signal implementation. The last was  
 this review thread:  
 http://forum.dlang.org/thread/ujlhznaphepibgtpcoqz forum.dlang.org. What  
 I still can't understand what is difference between signals and events  
 in languages like JavaScript, C# and Borland C++ (that has it's own  
 extension to language to implement events). As far as I understand in C#  
 events are based on delegates but have some limitations. They can only  
 be fired from owner's method. In JS events at my point of view are used  
 to notify some input events or DOM changes. Borland C++ uses them to  
 notify GUI events (in example button click). Is module called "signals"  
 only for not interfere with OS IO events or is there some difference and  
 reason?
It's called signals because they are addressed by name, and are global in scope. (provided I've read the information on std.signal correctly) There are also C#-like multi-cast delegate (event) implementations, such as my implementation. (https://github.com/Orvid/std.event)
Jan 16 2014