2 ms·
It's been awhile since I had to use it, but I recall the most common frustration from me was getting an unhandled exception with a call stack like: AnonymousMe
by blakeyrat 10y ago
It's been awhile since I had to use it, but I recall the most common frustration from me was getting an unhandled exception with a call stack like:
AnonymousMethod ->
AnonymousMethod ->
AnonymousMethod ->
AnonymousMethod ->
AnonymousMethod ->
AnonymousMethod ->
AnonymousMethod ->
AnonymousMethod ->
AnonymousMethod ->
AnonymousMethod
Occurring hours after I'd actually created the code that caused the exception.
Since I've moved jobs since then, I can't give a more specific example, sorry.
> that retain references to your code and evaluate them at arbitrary points in the future with deep internal control flow.
For the record, that appears to be exactly what was happening to me when I was struggling with D3.
- mbostock 10y agoWithout a more specific example to go on, it’s difficult to speculate. The only case where you’d get an error asynchronously should be in the case of transition.tween or an event listener—cases where the code is necessarily asynchronous—and not something like selection.attr or transition.attr, where the code can be evaluated synchronously. It’s true that D3 uses closures and anonymous functions internally. But assuming you are using a debugger and the non-minified code, you can use that debugger to see exactly what the code is doing. To continue with the example of selection.attr, the implementation is here: https://github.com/d3/d3-selection/blob/master/src/selection/attr.js https://github.com/d3/d3-selection/blob/master/src/selection... So a typical call stack would be three deep: selection.attr > selection.each > attrFunction’s closure.