_thrown_hooks = {}
_caught_hooks = {}

RV-Utils__Hook--throw(name, callback)
	if name in _thrown_hooks
		hook = _thrown_hooks[name]
	else    
		hook = {}
	
	hook[selector()] = callback
	_thrown_hooks[name] = hook

RV-Utils__Hook--catch(name, context)
	if selector() in _caught_hooks
		_catches = _caught_hooks[selector()]
	else
		_catches = {}
	_catches[name] = context
	_caught_hooks[selector()] = _catches
	
	for name, hook in _thrown_hooks
		if selector() in hook
			hook[selector()](context)

_generate_hooks()
	for catched_selector, catches in _caught_hooks
		for name, context in catches
			if name in _thrown_hooks
				hook = _thrown_hooks[name]
				for thrown_selector, callback in hook
					{thrown_selector}{catched_selector}
						callback(context)