3 ms·
I'm toying in build a new language (more in the "find ideas" than really doing it), and tough: Why I can't have events on functions? ie: Why I can't attach list
by mamcx 14y ago
I'm toying in build a new language (more in the "find ideas" than really doing it), and tough: Why I can't have events on functions? ie: Why I can't attach listener to the entry/exit of a function, in a transparent way (from https://gist.github.com/3777791 https://gist.github.com/3777791, where is still ugly as hell):
def startDef:
self.cache['start'] = now
def endDef:
performance.register(self.function.__name,'time', now - self.cache['start'])
hook(sample,pre = startDef, post = endDef)
Now with that ability, is possible to log with a graph the flow of the data in the program, in realtime. Still will lack the instant play but is a good start...
- andolanra 14y agoYou'll be wanting to look at defadvice in Common Lisp and elisp, then, which let you attach code to the entry and exit of a function. Python has decorators, as well, which are similar, but the entire purpose of defadvice is to do exactly what you're talking about.
- Evbn 14y ago"Aspect Oriented Programming"