Thanks a second time, I'm getting there! I realized one can look at the transformed javascript output, to see just what it does. The setting of the variable in the
defer becomes:
$.getJSON(url, __iced_deferrals.defer({
assign_fn: (function() {
return function() {
return json = arguments[0];
};
})(),
lineno: 6
}));
Presumably, when
the function that
__iced_deferrals.defer returns is
called by the code in .getJSON that delivers the result, it will set
arguments[0] to that result, and then call the
assign_fn above. This will set json to that result.
Also, I realize that it doesn't set json to the returned value of $.getJSON, as $.getJSON doesn't return anything - it uses a callback to deliver its result. It seems that ICS always works this way - which I guess implies that the use-case it's for always uses callbacks...
BTW: I'm not sure why the above has a function which is then called immediately. Maybe a coffeescript thing, for separating namespaces? I assume the lineno: 6 is for debugging - I recall some debate against this. Good to see it got in.