The jQuery style of namespacing of events seem to be overloaded on
what `namespacing` means.
It could be used to group events by the class of listeners as well as
nature of the event being triggered. That is, namespaces can be
created by both listeners and emitters and all such namespaces get
identical treatment in triggering and unbind functions.
The problem namespacing of events by emitter solves (reducing the
noise for the listener) and the one solved by grouping of listeners
(convenience in unbind phase) are mutually exclusive.
I think, such grouping of two exclusive sets into one leads to
confusion.
If one reads a piece of code like
searchService.on('searchResult.imageViewer.image', function()
{...});
she cannot determine which part of the namespace qualifies the nature
of the event and which part qualifies the listener, unless she goes
through code of all the emitters or listeners.
Rewriting the above line as follows
searchService.on('searchResult.image', function(){...}),
'ImageViewer');
makes it clear, that the searchResult.image is the specialization
searchResult event being emitted and isolates concern of grouping
listeners.
The "." in a namespace is used to indicate a specialization/nesting in
conventional namespace declarations. However, it is also overloaded to
indicate a tagging like behavior as in the case of CSS classes. It is
nearly equivalent of using same operator for both logical AND and OR.
If a decision to implement namespaces for events in Node is made, I
think, we should adopt the jQuery model of namespacing.
+ramki