<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>
<channel>
	<title>Comments for RGB(log)</title>
	<atom:link href="http://blog.rauschgenerator.com/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.rauschgenerator.com</link>
	<description>Actionscript and stuff</description>
	<pubDate>Wed, 08 Sep 2010 01:43:33 +0000</pubDate>
	
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>Comment on AS3: TimelineEvent, LabelEvent, FrameEvent by Uwe Holland</title>
		<link>http://blog.rauschgenerator.com/2009/05/23/as3-timelineevent-labelevent-frameevent/comment-page-1/#comment-16</link>
		<dc:creator>Uwe Holland</dc:creator>
		<pubDate>Fri, 02 Oct 2009 13:55:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rauschgenerator.com/?p=22#comment-16</guid>
		<description>thanks for the comment, gotta fix that!</description>
		<content:encoded><![CDATA[<p>thanks for the comment, gotta fix that!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Using Callback Commands instead of Events by Sandro</title>
		<link>http://blog.rauschgenerator.com/2009/09/26/using-callback-commands-instead-of-events/comment-page-1/#comment-14</link>
		<dc:creator>Sandro</dc:creator>
		<pubDate>Mon, 28 Sep 2009 21:38:53 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rauschgenerator.com/?p=40#comment-14</guid>
		<description>Hey Jackson,

i understand your point, but i think you're holding too much on the CallbackCommand, which is a special convenience, which i dont use very often anymore.
Actually a Command is pretty much different, and you can have arguments on functions again. Let me just explain it on an example. Or 2 as there are 2 (and even more) ways of doing it actually.
For one you could just do stateful commands, which means, that they can hold data. This is not always convenient, but it also has its advantages (when you have to dispatch the same command very often this is of course inconvenient, as you'd have to clone/create a lot of commands, but for larger commands this is actually quite nice)
what i'd do is make for example a NavigationCommand which you give the navigationID where to go to. This comamnd will store this id and the executor just calls an execute(); so it doesnt need to know what is called.
Also in turn the one creating it does not need to know how this is done, cause the command will handle everything.
The Command itself can ofcourse call a lot of functions and they can have arguments.
For one thing you mentioned later imagine for example a LoadCommand, which is maybe not only an ICommand but a special one you could give some data. For example it will load a SWF so it might be an ISWFLoadCommand (or something like that) interface which this command will also implement. you'll hand this over to your loader and the loader will set the data and dispatch/execute this one. This way the command does not have to fetch the data, and the loader only knows what it needs to know - no more - no less.
So basically by using interfaces you could overcome all those obstacles.

There is also a 3rd way of doing it by using a complete model strategy, which i prefer mostly. I tend to like it to have my application-state in one defined model - everything. So when i stop it, i could just read out that model and i know whats going on (i could also save this, load it, or dump it to recreate bugs user's caused, etc, and it is fucking nice for any undo/redo functionality)
In this case your commands can store data, but will mostly only get some parameters, but will never store the current state. As soon, as they are executed, they will exclusevly work on the model - for example by giving your command the "place to look" and your loader the "place to store" the data. Actually Loading would then split up into a StoreCommand which is dispatched by the loader (which in turn in some way needs to know where to store - you could use an interface here again so it does not need to know directly, but just sets the data) and a Command which will do the real work on WHAT to do with your data. Splitting it up that way may seem bad performancewise but you'll get a nice stack of "things which are done" in your application. Actually separating each store, and each work will make any undo/redo functionality you have to implement nicely easy.
The later one would benefit a lot from a database-like model, but for know flash does not have something like that for the web unfortunately. What i'd like to do there is basically store data not directly by accessing the model, but more like you know it from hibernate, where you get an object from the datalayer, modify it, and then attach it back on (like with save(); or if it is disconnected its gonna get a bit more difficult) - this would actually help a lot with binding, where you often want to store a bunch of things in one step and dont fire a single binding before that happens (transaction like). i have already plans to do that, but it's not an easy project and my time is unfortunately very limited. Actually it would be much better for adobe to pick it up and give us a speedy version of this not completely implemented in as3, but thats maybe just wishful thinking :)</description>
		<content:encoded><![CDATA[<p>Hey Jackson,</p>
<p>i understand your point, but i think you&#8217;re holding too much on the CallbackCommand, which is a special convenience, which i dont use very often anymore.<br />
Actually a Command is pretty much different, and you can have arguments on functions again. Let me just explain it on an example. Or 2 as there are 2 (and even more) ways of doing it actually.<br />
For one you could just do stateful commands, which means, that they can hold data. This is not always convenient, but it also has its advantages (when you have to dispatch the same command very often this is of course inconvenient, as you&#8217;d have to clone/create a lot of commands, but for larger commands this is actually quite nice)<br />
what i&#8217;d do is make for example a NavigationCommand which you give the navigationID where to go to. This comamnd will store this id and the executor just calls an execute(); so it doesnt need to know what is called.<br />
Also in turn the one creating it does not need to know how this is done, cause the command will handle everything.<br />
The Command itself can ofcourse call a lot of functions and they can have arguments.<br />
For one thing you mentioned later imagine for example a LoadCommand, which is maybe not only an ICommand but a special one you could give some data. For example it will load a SWF so it might be an ISWFLoadCommand (or something like that) interface which this command will also implement. you&#8217;ll hand this over to your loader and the loader will set the data and dispatch/execute this one. This way the command does not have to fetch the data, and the loader only knows what it needs to know - no more - no less.<br />
So basically by using interfaces you could overcome all those obstacles.</p>
<p>There is also a 3rd way of doing it by using a complete model strategy, which i prefer mostly. I tend to like it to have my application-state in one defined model - everything. So when i stop it, i could just read out that model and i know whats going on (i could also save this, load it, or dump it to recreate bugs user&#8217;s caused, etc, and it is fucking nice for any undo/redo functionality)<br />
In this case your commands can store data, but will mostly only get some parameters, but will never store the current state. As soon, as they are executed, they will exclusevly work on the model - for example by giving your command the &#8220;place to look&#8221; and your loader the &#8220;place to store&#8221; the data. Actually Loading would then split up into a StoreCommand which is dispatched by the loader (which in turn in some way needs to know where to store - you could use an interface here again so it does not need to know directly, but just sets the data) and a Command which will do the real work on WHAT to do with your data. Splitting it up that way may seem bad performancewise but you&#8217;ll get a nice stack of &#8220;things which are done&#8221; in your application. Actually separating each store, and each work will make any undo/redo functionality you have to implement nicely easy.<br />
The later one would benefit a lot from a database-like model, but for know flash does not have something like that for the web unfortunately. What i&#8217;d like to do there is basically store data not directly by accessing the model, but more like you know it from hibernate, where you get an object from the datalayer, modify it, and then attach it back on (like with save(); or if it is disconnected its gonna get a bit more difficult) - this would actually help a lot with binding, where you often want to store a bunch of things in one step and dont fire a single binding before that happens (transaction like). i have already plans to do that, but it&#8217;s not an easy project and my time is unfortunately very limited. Actually it would be much better for adobe to pick it up and give us a speedy version of this not completely implemented in as3, but thats maybe just wishful thinking :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Using Callback Commands instead of Events by Curry Functions &#171; JacksonDunstan.com</title>
		<link>http://blog.rauschgenerator.com/2009/09/26/using-callback-commands-instead-of-events/comment-page-1/#comment-13</link>
		<dc:creator>Curry Functions &#171; JacksonDunstan.com</dc:creator>
		<pubDate>Mon, 28 Sep 2009 09:11:33 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rauschgenerator.com/?p=40#comment-13</guid>
		<description>[...] my runnables technique for implementing function pointers over on the Rausch Generator Blog, I commented about the usefulness of the currying technique, mostly in callbacks. It occurred to me that [...]</description>
		<content:encoded><![CDATA[<p>[...] my runnables technique for implementing function pointers over on the Rausch Generator Blog, I commented about the usefulness of the currying technique, mostly in callbacks. It occurred to me that [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on AS3: TimelineEvent, LabelEvent, FrameEvent by Jackson Dunstan</title>
		<link>http://blog.rauschgenerator.com/2009/05/23/as3-timelineevent-labelevent-frameevent/comment-page-1/#comment-12</link>
		<dc:creator>Jackson Dunstan</dc:creator>
		<pubDate>Sun, 27 Sep 2009 23:59:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rauschgenerator.com/?p=22#comment-12</guid>
		<description>I think you left some new operators in there:

&lt;cite&gt;
clip.addEventListener(new FrameEvent.LABEL, onFrameLabel);
clip.addEventListener(new FrameEvent.BEGIN, onFrameLabel);
clip.addEventListener(new FrameEvent.END, onFrameLabel);
&lt;/cite&gt;

Otherwise, this is handy. Thanks!</description>
		<content:encoded><![CDATA[<p>I think you left some new operators in there:</p>
<p><cite><br />
clip.addEventListener(new FrameEvent.LABEL, onFrameLabel);<br />
clip.addEventListener(new FrameEvent.BEGIN, onFrameLabel);<br />
clip.addEventListener(new FrameEvent.END, onFrameLabel);<br />
</cite></p>
<p>Otherwise, this is handy. Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Using Callback Commands instead of Events by Jackson Dunstan</title>
		<link>http://blog.rauschgenerator.com/2009/09/26/using-callback-commands-instead-of-events/comment-page-1/#comment-11</link>
		<dc:creator>Jackson Dunstan</dc:creator>
		<pubDate>Sat, 26 Sep 2009 22:18:27 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rauschgenerator.com/?p=40#comment-11</guid>
		<description>Hey Sandro and Uwe, I think you have some really good points here. Firstly, about speed I was mostly responding to Uwe's assertion at the end of the post:

&lt;cite&gt;
I haven’t checked the performance losses against direct callbacks yet but it shouldn’t be that much slower. 
&lt;/cite&gt;

I wanted to point out that commands will be slower than callbacks, which are in turn (much) slower than runnables. I haven't tested commands, but perhaps they are not so much slower than direct callbacks.

You guys are absolutely right about the convenience of just having one interface. This will have a material benefit in that multiple interfaces will start to bloat up your SWF size.

I think when I first read the article I made the mistake of thinking that the parameters to the callback were going to be passed via Function.apply(), but now see that the extra args are simply for convenience. In my view, it would be better to separate out this extra argument functionality the &lt;a href="http://en.wikipedia.org/wiki/Currying" rel="nofollow"&gt;currying&lt;/a&gt; technique, which is rather easy to implement in AS3. If you do this you will find that a command is almost exactly like Java's Runnable except that it holds a Function variable rather than being implemented by a class with the execute()/run() method. This is precisely the cause of the slowdown. However, as you guys point out, performance is not always everything. This would really only matter in performance-critical code.

About the GC, I really do think that commands as shown above do not help the GC. You point out that the command can be nulled out after it is used, but so could a runnable or a direct callback. Nulling out any of these would result in dereferencing the object holding the callback function and therefore freeing it up to be garbage collected.

Lastly, I think it's worth noting that the command technique forces all callbacks to take no arguments. This is good for keeping the single-interface design and keeping the callee from knowing about the caller and visa versa, as you guys point out. However, the problem is that this forces the class to expose as a public variable (or getter) what would normally be passed as parameters to the callback function. This leads to a bizarre assembly-style devolution where the extremely useful convention of passing arguments to functions is eschewed in favor of storing a variable and then retrieving it later. This breaks up what is essentially a message like "hey, here is your loaded display object" into a sequence "hey, I finished loading" then "could you give me what you loaded?". This may force unnecessary storage of temporary values that would normally be simply passed as function arguments in fields of the class. It may also force the creation of getters. Both add a typing, SWF size bloat, and awkwardness. They also make it harder to determine when to get rid of such a temporary. For example, how long do you need to keep it? One frame? One getter call? Forever?.

Thanks for the discussion on this. It's been fascinating hearing your arguments for a technique I had previously never even heard of. I think that in some circumstances this could be very useful.</description>
		<content:encoded><![CDATA[<p>Hey Sandro and Uwe, I think you have some really good points here. Firstly, about speed I was mostly responding to Uwe&#8217;s assertion at the end of the post:</p>
<p><cite><br />
I haven’t checked the performance losses against direct callbacks yet but it shouldn’t be that much slower.<br />
</cite></p>
<p>I wanted to point out that commands will be slower than callbacks, which are in turn (much) slower than runnables. I haven&#8217;t tested commands, but perhaps they are not so much slower than direct callbacks.</p>
<p>You guys are absolutely right about the convenience of just having one interface. This will have a material benefit in that multiple interfaces will start to bloat up your SWF size.</p>
<p>I think when I first read the article I made the mistake of thinking that the parameters to the callback were going to be passed via Function.apply(), but now see that the extra args are simply for convenience. In my view, it would be better to separate out this extra argument functionality the <a href="http://en.wikipedia.org/wiki/Currying" rel="nofollow">currying</a> technique, which is rather easy to implement in AS3. If you do this you will find that a command is almost exactly like Java&#8217;s Runnable except that it holds a Function variable rather than being implemented by a class with the execute()/run() method. This is precisely the cause of the slowdown. However, as you guys point out, performance is not always everything. This would really only matter in performance-critical code.</p>
<p>About the GC, I really do think that commands as shown above do not help the GC. You point out that the command can be nulled out after it is used, but so could a runnable or a direct callback. Nulling out any of these would result in dereferencing the object holding the callback function and therefore freeing it up to be garbage collected.</p>
<p>Lastly, I think it&#8217;s worth noting that the command technique forces all callbacks to take no arguments. This is good for keeping the single-interface design and keeping the callee from knowing about the caller and visa versa, as you guys point out. However, the problem is that this forces the class to expose as a public variable (or getter) what would normally be passed as parameters to the callback function. This leads to a bizarre assembly-style devolution where the extremely useful convention of passing arguments to functions is eschewed in favor of storing a variable and then retrieving it later. This breaks up what is essentially a message like &#8220;hey, here is your loaded display object&#8221; into a sequence &#8220;hey, I finished loading&#8221; then &#8220;could you give me what you loaded?&#8221;. This may force unnecessary storage of temporary values that would normally be simply passed as function arguments in fields of the class. It may also force the creation of getters. Both add a typing, SWF size bloat, and awkwardness. They also make it harder to determine when to get rid of such a temporary. For example, how long do you need to keep it? One frame? One getter call? Forever?.</p>
<p>Thanks for the discussion on this. It&#8217;s been fascinating hearing your arguments for a technique I had previously never even heard of. I think that in some circumstances this could be very useful.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Using Callback Commands instead of Events by Sandro</title>
		<link>http://blog.rauschgenerator.com/2009/09/26/using-callback-commands-instead-of-events/comment-page-1/#comment-10</link>
		<dc:creator>Sandro</dc:creator>
		<pubDate>Sat, 26 Sep 2009 17:23:09 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rauschgenerator.com/?p=40#comment-10</guid>
		<description>Hey Jackson,

Uwe got it right here in another Point than Performance (that is not all so very essential all the time). And i do think we have to differ here, what we want to do. There are several approaches, and each of them has it's drawbacks. I really believe, that there is no "one fits all" strategy all the time, although the command model works quite well - it also has its problems in some areas. (It can also solve it and speed up like hell, but that will only work good on multi-core models - and flash does not have multithreading yet - except for the asynchronous loads maybe - there we do have concurrency at least)
Command Model CAN solve your speed problem, as it CAN use direct function calls. As Uwe described, CallbackCommand is more like a "convenience command" for hooking up stuff in existing code and to easily make a quick test or mockup, but its not the way of doing it all over your application. Actually Command will change your whole way of thinking about "where to put functionality". - it will reside *in* your Command. 
So making a callback is actually quite weird, as it violates the concept of commands, but for quick testing it is sometimes very convenient.
One nice thing about it is also
When someone dispatches a command - as your view or anyone else. He does not know *which command* it is maybe (he might know, but does not have to) - but when you are debugging YOU SEE which it is. You directly see the command, go there - click - and voila, you see what this command is doing. Not a name - but the code it is executing - directly. You dont look up strange event maps here. This is an advantage over events.
You could say - hey function calls can do that too - well - partly. Suppose you want to give your function some input parameters - then it doesnt work anymore. Suppose the caller should not know about all of them (mostly not any of them). Function calls dont support that without you violating type-safety. One thing you do get are funny compiler errors when finally this function is called in a wrong way - and it will.

Both these situations are solved by Command AND Runnable equally. And they are both faster, as soon, as they dont use Callbacks. Only thing about command are some special things all commands have in common.
For one there is execute();
you have it - always. (There are people that use parametrized execute() methods - please god, let them suffer for their sins - it is a way of doing stateless-commands - but it hurts so much as you completely lose control over your code again - there are other ways of doing that, which are completely typed and do not involve casting of events into something else - hello cairngorm etc)

oh i got broken off here

another thing i might add is, that i remember runnable from java, but it was mainly used for threads&amp;stuff. but basically runnable with having only the interface of run(); as you've shown is basically the same, named another way and definitely better than events :)</description>
		<content:encoded><![CDATA[<p>Hey Jackson,</p>
<p>Uwe got it right here in another Point than Performance (that is not all so very essential all the time). And i do think we have to differ here, what we want to do. There are several approaches, and each of them has it&#8217;s drawbacks. I really believe, that there is no &#8220;one fits all&#8221; strategy all the time, although the command model works quite well - it also has its problems in some areas. (It can also solve it and speed up like hell, but that will only work good on multi-core models - and flash does not have multithreading yet - except for the asynchronous loads maybe - there we do have concurrency at least)<br />
Command Model CAN solve your speed problem, as it CAN use direct function calls. As Uwe described, CallbackCommand is more like a &#8220;convenience command&#8221; for hooking up stuff in existing code and to easily make a quick test or mockup, but its not the way of doing it all over your application. Actually Command will change your whole way of thinking about &#8220;where to put functionality&#8221;. - it will reside *in* your Command.<br />
So making a callback is actually quite weird, as it violates the concept of commands, but for quick testing it is sometimes very convenient.<br />
One nice thing about it is also<br />
When someone dispatches a command - as your view or anyone else. He does not know *which command* it is maybe (he might know, but does not have to) - but when you are debugging YOU SEE which it is. You directly see the command, go there - click - and voila, you see what this command is doing. Not a name - but the code it is executing - directly. You dont look up strange event maps here. This is an advantage over events.<br />
You could say - hey function calls can do that too - well - partly. Suppose you want to give your function some input parameters - then it doesnt work anymore. Suppose the caller should not know about all of them (mostly not any of them). Function calls dont support that without you violating type-safety. One thing you do get are funny compiler errors when finally this function is called in a wrong way - and it will.</p>
<p>Both these situations are solved by Command AND Runnable equally. And they are both faster, as soon, as they dont use Callbacks. Only thing about command are some special things all commands have in common.<br />
For one there is execute();<br />
you have it - always. (There are people that use parametrized execute() methods - please god, let them suffer for their sins - it is a way of doing stateless-commands - but it hurts so much as you completely lose control over your code again - there are other ways of doing that, which are completely typed and do not involve casting of events into something else - hello cairngorm etc)</p>
<p>oh i got broken off here</p>
<p>another thing i might add is, that i remember runnable from java, but it was mainly used for threads&amp;stuff. but basically runnable with having only the interface of run(); as you&#8217;ve shown is basically the same, named another way and definitely better than events :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Using Callback Commands instead of Events by Uwe Holland</title>
		<link>http://blog.rauschgenerator.com/2009/09/26/using-callback-commands-instead-of-events/comment-page-1/#comment-9</link>
		<dc:creator>Uwe Holland</dc:creator>
		<pubDate>Sat, 26 Sep 2009 11:42:07 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rauschgenerator.com/?p=40#comment-9</guid>
		<description>I guess considering speed you're absolutely right. As you call the method on the object instance itself you should have the fastest possible version.

But when it comes to garbage collection I'm not sure about it. To make use of your approach you have to assign the whole object to a caller. Being referenced there you cannot destroy this object since it's locked until you kill the reference.

By using a method as parameter you can &lt;code&gt;null&lt;/code&gt; the function reference right after execution (if you need it just once -&gt; e.g. in a loader) and the command itself can be destroyed. (And the object with the referenced method should be destroyable all the time since it's just a method reference which can be null)

OR 

you can clone it and use it again (e.g. for a menu with a bunch of menuitems) which need to stay clickable.

But in my opinion the main advantage is the flexibility because you've got just one Interface -&gt; &lt;code&gt;ICommand&lt;/code&gt; instead of several for different purposes. The &lt;code&gt;CallbackCommand&lt;/code&gt; is some kind of a side product because it's not really a command - it just acts like that. Instead you should use those "real" commands  (ASyncCommands, MacroComands etc.) which was the initial idea of doing it that way.

That it became faster compared to events was nice too. I'm also glad to read other people fighting the same interests and issues. :-)</description>
		<content:encoded><![CDATA[<p>I guess considering speed you&#8217;re absolutely right. As you call the method on the object instance itself you should have the fastest possible version.</p>
<p>But when it comes to garbage collection I&#8217;m not sure about it. To make use of your approach you have to assign the whole object to a caller. Being referenced there you cannot destroy this object since it&#8217;s locked until you kill the reference.</p>
<p>By using a method as parameter you can <code>null</code> the function reference right after execution (if you need it just once -&gt; e.g. in a loader) and the command itself can be destroyed. (And the object with the referenced method should be destroyable all the time since it&#8217;s just a method reference which can be null)</p>
<p>OR </p>
<p>you can clone it and use it again (e.g. for a menu with a bunch of menuitems) which need to stay clickable.</p>
<p>But in my opinion the main advantage is the flexibility because you&#8217;ve got just one Interface -&gt; <code>ICommand</code> instead of several for different purposes. The <code>CallbackCommand</code> is some kind of a side product because it&#8217;s not really a command - it just acts like that. Instead you should use those &#8220;real&#8221; commands  (ASyncCommands, MacroComands etc.) which was the initial idea of doing it that way.</p>
<p>That it became faster compared to events was nice too. I&#8217;m also glad to read other people fighting the same interests and issues. :-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Using Callback Commands instead of Events by Jackson Dunstan</title>
		<link>http://blog.rauschgenerator.com/2009/09/26/using-callback-commands-instead-of-events/comment-page-1/#comment-8</link>
		<dc:creator>Jackson Dunstan</dc:creator>
		<pubDate>Sat, 26 Sep 2009 01:32:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rauschgenerator.com/?p=40#comment-8</guid>
		<description>I think the problem here is that you replace a direct function call like __callback.onLoaded(dispObj) with a dynamic function call on a Function variable like _func.apply(this,_args). Since this approach uses a Function variable, I would expect it to be at least as slow as a simple callback like __callback(). Further, it makes that dynamic function call only after doing a dynamic access to the apply field of the Function. So I would expect worse performance than a simple callback strategy.

Additionally, I don't think this helps with garbage collection. If the Function that the CallbackCommand holds is a non-static method of a class, like most functions are, it will have an implicit reference to the instance of the class the method is associated with, ie. its this pointer/reference. You've essentially converted this:

MyAPILoader -&gt; Function (callback) -&gt; TheClassUsingIt

To...

MyAPILoader -&gt; CallbackCommand -&gt; Function (callback) -&gt; TheClassUsingIt

If this were not true, how would CallbackCommand know which instance of TheClassUsingIt to call the method on?

I'd be interested to hear your thoughts on these two concerns of mine. Also, it's nice to know that there are others out there who share these niche concerns of mine. :)</description>
		<content:encoded><![CDATA[<p>I think the problem here is that you replace a direct function call like __callback.onLoaded(dispObj) with a dynamic function call on a Function variable like _func.apply(this,_args). Since this approach uses a Function variable, I would expect it to be at least as slow as a simple callback like __callback(). Further, it makes that dynamic function call only after doing a dynamic access to the apply field of the Function. So I would expect worse performance than a simple callback strategy.</p>
<p>Additionally, I don&#8217;t think this helps with garbage collection. If the Function that the CallbackCommand holds is a non-static method of a class, like most functions are, it will have an implicit reference to the instance of the class the method is associated with, ie. its this pointer/reference. You&#8217;ve essentially converted this:</p>
<p>MyAPILoader -&gt; Function (callback) -&gt; TheClassUsingIt</p>
<p>To&#8230;</p>
<p>MyAPILoader -&gt; CallbackCommand -&gt; Function (callback) -&gt; TheClassUsingIt</p>
<p>If this were not true, how would CallbackCommand know which instance of TheClassUsingIt to call the method on?</p>
<p>I&#8217;d be interested to hear your thoughts on these two concerns of mine. Also, it&#8217;s nice to know that there are others out there who share these niche concerns of mine. :)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
