What I’m up to: Viral Functions

I’ve been working on a little side project for the past week that gets functions in Javascript to infect other functions and wrap them in custom snippets of code.   It’s modeled after how viruses in the body attack cells and reprogram them to build more viruses.

It’s largely an exercise in curiosity at the moment, I don’t really know how effective it will be or what I could end up doing with it.  I had a working version that I ended up forgetting to save on jsFiddle, which was a huge bummer because I don’t remember how the heck I made it work.

Recently I recreated the base using (I think) a different method.  Contrary to many other objects, functions in Javascript are passed around by value, not reference, because Javascript.  Normally you’d wrap the function in an Object, but since I won’t be able to do that with the final product, I use a different method to make sure I’m accessing the actual function and not just a copy.

I believe the below fix would only be necessary on functions in the global context, but I haven’t done any testing to confirm this.  I wish I could find my original code.


I’ll keep the blog updated if anything interesting happens with it.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">