{"id":5536,"date":"2019-05-01T22:23:34","date_gmt":"2019-05-01T20:23:34","guid":{"rendered":"https:\/\/monodes.com\/predaelli\/?p=5536"},"modified":"2019-05-01T22:23:34","modified_gmt":"2019-05-01T20:23:34","slug":"inspecting-one-of-the-most-famous-javascript-bugs-of-all-time","status":"publish","type":"post","link":"https:\/\/monodes.com\/predaelli\/2019\/05\/01\/inspecting-one-of-the-most-famous-javascript-bugs-of-all-time\/","title":{"rendered":"Inspecting one of the most famous JavaScript bugs of all time"},"content":{"rendered":"<blockquote><p>One fine day evening, after writing a handful of beautiful JavaScript code, sipping your coffee, you smile\u200a\u2014\u200athe code looks especially\u2026<\/p><\/blockquote>\n<p>After reading <em><a href=\"https:\/\/medium.freecodecamp.org\/inspecting-one-of-the-most-famous-javascript-bugs-of-all-time-61e7c27fe603\">Inspecting one of the most famous JavaScript bugs of all time<\/a> one may wonder how such flaws does not &#8220;explode&#8221; in the face of every developer, subtle as it is<\/em><\/p>\n<p><!--more--><!--nextpage--><\/p>\n<blockquote>\n<h1 id=\"d324\" class=\"graf graf--h3 graf--leading graf--title\">Inspecting one of the most famous JavaScript bugs of all\u00a0time.<\/h1>\n<div class=\"uiScale uiScale-ui--regular uiScale-caption--regular u-flexCenter u-marginVertical24 u-fontSize15 js-postMetaLockup\">\n<div class=\"u-flex0\"><a class=\"link u-baseColor--link avatar\" dir=\"auto\" href=\"https:\/\/medium.freecodecamp.org\/@aiswaryakkrish?source=post_header_lockup\" data-action=\"show-user-card\" data-action-source=\"post_header_lockup\" data-action-value=\"e01fd3f8d1a1\" data-action-type=\"hover\" data-user-id=\"e01fd3f8d1a1\" data-collection-slug=\"free-code-camp\"><img data-recalc-dims=\"1\" decoding=\"async\" class=\"avatar-image u-size50x50\" src=\"https:\/\/i0.wp.com\/cdn-images-1.medium.com\/fit\/c\/100\/100\/1%2AWgsKli9SFKYNG1gYdP90SA.jpeg?w=910&#038;ssl=1\" alt=\"Go to the profile of aiswarya krishna\" \/><\/a><\/div>\n<div class=\"u-flex1 u-paddingLeft15 u-overflowHidden\">\n<div class=\"u-paddingBottom3\"><a class=\"ds-link ds-link--styleSubtle ui-captionStrong u-inlineBlock link link--darken link--darker\" dir=\"auto\" href=\"https:\/\/medium.freecodecamp.org\/@aiswaryakkrish\" data-action=\"show-user-card\" data-action-value=\"e01fd3f8d1a1\" data-action-type=\"hover\" data-user-id=\"e01fd3f8d1a1\" data-collection-slug=\"free-code-camp\">aiswarya krishna<\/a><\/div>\n<\/div>\n<\/div>\n<div class=\"ui-caption u-noWrapWithEllipsis js-testPostMetaInlineSupplemental\"><time datetime=\"2019-04-05T17:33:35.560Z\">Apr 5<\/time><\/div>\n<div class=\"aspectRatioPlaceholder is-locked\">\n<div class=\"aspectRatioPlaceholder-fill\"><\/div>\n<div class=\"progressiveMedia js-progressiveMedia graf-image is-canvasLoaded is-imageLoaded\" data-image-id=\"1*gHU4sfE-LVZHDL0sBxJ2kA.jpeg\" data-width=\"3840\" data-height=\"5760\" data-is-featured=\"true\" data-action=\"zoom\" data-action-value=\"1*gHU4sfE-LVZHDL0sBxJ2kA.jpeg\" data-scroll=\"native\"><\/div>\n<\/div>\n<figure id=\"3026\" class=\"graf graf--figure graf-after--h3\">\n<div class=\"aspectRatioPlaceholder is-locked\">\n<div class=\"progressiveMedia js-progressiveMedia graf-image is-canvasLoaded is-imageLoaded\" data-image-id=\"1*gHU4sfE-LVZHDL0sBxJ2kA.jpeg\" data-width=\"3840\" data-height=\"5760\" data-is-featured=\"true\" data-action=\"zoom\" data-action-value=\"1*gHU4sfE-LVZHDL0sBxJ2kA.jpeg\" data-scroll=\"native\"><img data-recalc-dims=\"1\" decoding=\"async\" class=\"progressiveMedia-image js-progressiveMedia-image\" src=\"https:\/\/i0.wp.com\/cdn-images-1.medium.com\/max\/1600\/1%2AgHU4sfE-LVZHDL0sBxJ2kA.jpeg?w=910&#038;ssl=1\" data-src=\"https:\/\/cdn-images-1.medium.com\/max\/1600\/1*gHU4sfE-LVZHDL0sBxJ2kA.jpeg\" \/><\/div>\n<\/div>\n<\/figure>\n<p id=\"4078\" class=\"graf graf--p graf-after--figure\">One fine day evening, after writing a handful of beautiful JavaScript code, sipping your coffee, you smile\u200a\u2014\u200athe code looks especially beautiful today, and you feel a sense or serenity filling your head.<\/p>\n<p id=\"5726\" class=\"graf graf--p graf-after--p\">Then you decide to fire up your debug console and take a look at the memory consumption, and the performance.<\/p>\n<p id=\"818a\" class=\"graf graf--p graf-after--p\">You take one peek at the console inspector and the sense of serenity is long gone, and something sends chills down your spine.<\/p>\n<p id=\"93a6\" class=\"graf graf--p graf-after--p\">The trace shows a mounting slope that resembles the temperature graph of planet Earth. It\u2019s bad. Quite bad.<\/p>\n<p id=\"8b46\" class=\"graf graf--p graf-after--p\">You are leaking memory. And even forcing the GC to do a force sweep doesn\u2019t do you any favors. Your once-so-beautiful code is now a tangled mess of leaky logic.<\/p>\n<p id=\"086f\" class=\"graf graf--p graf-after--p\">As developers, we all have gone through this scenario before. We have coded, inspected and spent days racking our brains over leaky code.<\/p>\n<p id=\"fc21\" class=\"graf graf--p graf-after--p\">But the below sets a new standard for leaky code. And it required a new diagnosis to isolate and fix it.<\/p>\n<p id=\"800e\" class=\"graf graf--p graf-after--p\">Here, I am dissecting one of the most famous JavaScript bugs of all time, and yes, it was caused by a faulty implementation of closure.<\/p>\n<p id=\"1399\" class=\"graf graf--p graf-after--p\">Let\u2019s jump right in.<\/p>\n<p id=\"f300\" class=\"graf graf--p graf-after--p\">Imagine the following code:<\/p>\n<pre id=\"2597\" class=\"graf graf--pre graf-after--p\">var theThing = null;<\/pre>\n<pre id=\"16a2\" class=\"graf graf--pre graf-after--pre\">var replaceThing = function ()<\/pre>\n<pre id=\"690b\" class=\"graf graf--pre graf-after--pre\">        {<\/pre>\n<pre id=\"8345\" class=\"graf graf--pre graf-after--pre\">var originalThing = theThing;<\/pre>\n<pre id=\"521a\" class=\"graf graf--pre graf-after--pre\"> theThing = {\n            longStr: new Array(1000000).join(\u2018*\u2019)\n            };<\/pre>\n<pre id=\"457d\" class=\"graf graf--pre graf-after--pre\">        };<\/pre>\n<pre id=\"a66d\" class=\"graf graf--pre graf-after--pre\">setInterval(replaceThing, 1000);<\/pre>\n<p id=\"565e\" class=\"graf graf--p graf-after--pre\">Every second, the replaceThing function will be executed. theThing variable will be replaced with a new object containing a gigantic string. Before that, the original value of theThing is saved in a local variable originalThing. After the function is returned, the old value of theThing can be garbage collected, which also happens to collect the long string inside it, because nothing refers to it anymore.<\/p>\n<p id=\"f6de\" class=\"graf graf--p graf-after--p\">So the memory allocation is pretty straightforward: it allocates a big string at every iteration of the function, and at the same time, it deletes the previous big string. So there are no further references to originalThing and theThing, which leads to their collection.<\/p>\n<p id=\"ae1d\" class=\"graf graf--p graf-after--p\">Not a big deal huh?<\/p>\n<p id=\"b0c5\" class=\"graf graf--p graf-after--p\">But what if we had a certain specific set of needs that required us to create a closure inside replaceThing, thereby outlasting replaceThing?<\/p>\n<p id=\"874f\" class=\"graf graf--p graf-after--p\">Like in the following code:<\/p>\n<pre id=\"7d92\" class=\"graf graf--pre graf-after--p\">var theThing = null;<\/pre>\n<pre id=\"14de\" class=\"graf graf--pre graf-after--pre\">var replaceThing = function ()<\/pre>\n<pre id=\"839b\" class=\"graf graf--pre graf-after--pre\">{<\/pre>\n<pre id=\"1c57\" class=\"graf graf--pre graf-after--pre\">var originalThing = theThing;<\/pre>\n<pre id=\"e431\" class=\"graf graf--pre graf-after--pre\">theThing = {<\/pre>\n<pre id=\"f87d\" class=\"graf graf--pre graf-after--pre\">            longStr: new Array(1000000).join(\u2018*\u2019),<\/pre>\n<pre id=\"ee4c\" class=\"graf graf--pre graf-after--pre\">            someMethod: function () {<\/pre>\n<pre id=\"b5ed\" class=\"graf graf--pre graf-after--pre\">                        console.log(someMessage);<\/pre>\n<pre id=\"5d6b\" class=\"graf graf--pre graf-after--pre\">                                    }<\/pre>\n<pre id=\"301a\" class=\"graf graf--pre graf-after--pre\">           };<\/pre>\n<pre id=\"9e73\" class=\"graf graf--pre graf-after--pre\">};<\/pre>\n<pre id=\"bc53\" class=\"graf graf--pre graf-after--pre\">setInterval(replaceThing, 1000);<\/pre>\n<p id=\"e9b0\" class=\"graf graf--p graf-after--pre\">Now there is a new function \u201csomeMethod\u201d inside theThing object. This sets up a closure scope. This is another way of saying that someMethod needs access to originalThing and theThing even after the function replaceThing has exited. I mean, that\u2019s the entire point of closures right? So this can lead to boundless memory growth, since each iteration of the replaceThing function, creates its own version of theThing and that version would point to the previous version through originalThing.<\/p>\n<p id=\"e80e\" class=\"graf graf--p graf-after--p\">Fortunately, most JavaScript runtimes (that run behind Chrome, Node and React) are smart enough to understand that originalThing is not actually used in the closure \u201csomeMethod\u201d. So it is not put into someMethod\u2019s closure scope, and is eventually GC\u2019d when the function replaceThing exits.<\/p>\n<p id=\"9c34\" class=\"graf graf--p graf-after--p\">Lucky for us, there is no reference ever anywhere to originalThing.<\/p>\n<p id=\"9841\" class=\"graf graf--p graf-after--p\">Wow. So far so good.<\/p>\n<p id=\"2a69\" class=\"graf graf--p graf-after--p\"><strong class=\"markup--strong markup--p-strong\">So next level down, we bring in the big guns.<\/strong><\/p>\n<p id=\"f52a\" class=\"graf graf--p graf-after--p\">What if we had a reference somewhere to originalThing, that requires the closure to hold onto originalThing?<\/p>\n<p id=\"dbb3\" class=\"graf graf--p graf-after--p\">That would make things ugly.<\/p>\n<pre id=\"fe65\" class=\"graf graf--pre graf-after--p\">var theThing = null;<\/pre>\n<pre id=\"78c7\" class=\"graf graf--pre graf-after--pre\">var replaceThing = function () {\nvar originalThing = theThing;<\/pre>\n<pre id=\"ce95\" class=\"graf graf--pre graf-after--pre\">var unused =  function () {<\/pre>\n<pre id=\"39bb\" class=\"graf graf--pre graf-after--pre\"> if (originalThing)\n     console.log(\u201chi\u201d);<\/pre>\n<pre id=\"f738\" class=\"graf graf--pre graf-after--pre\">             };<\/pre>\n<pre id=\"7617\" class=\"graf graf--pre graf-after--pre\">     theThing = {\n                 longStr: new Array(1000000).join(\u2018*\u2019),\n                 someMethod: function () {\n                             console.log(someMessage);<\/pre>\n<pre id=\"d492\" class=\"graf graf--pre graf-after--pre\">                 }<\/pre>\n<pre id=\"6618\" class=\"graf graf--pre graf-after--pre\">                };<\/pre>\n<pre id=\"d2f0\" class=\"graf graf--pre graf-after--pre\">setInterval(replaceThing, 1000);<\/pre>\n<p id=\"2c5b\" class=\"graf graf--p graf-after--pre\">Fire up your console and take a look.<\/p>\n<p id=\"1acc\" class=\"graf graf--p graf-after--p\">We\u2019re using an extra megabyte every second! So it looks like we are leaking longStr.<\/p>\n<p id=\"d5dd\" class=\"graf graf--p graf-after--p\">But nothing seems to have changed. OriginalThing is referenced in only two places. One is in the main body of the function replaceThing, and the other is inside the function unused. Both of these get cleaned up once replaceThing ends. We don\u2019t even run the function \u201cunused\u201d\u00a0. The only stuff that escapes the destruction of replaceThing is the closure created around \u201csomeMethod\u201d. Surprisingly, someMethod doesn\u2019t event refer to originalString!<\/p>\n<p id=\"bb54\" class=\"graf graf--p graf-after--p\">This behaviour has a lot to do with the way closures are implemented in JavaScript.<\/p>\n<p id=\"19f3\" class=\"graf graf--p graf-after--p\">In JavaScript, as we already know, every function is an object. This object has access to another object that represents its scope. So, if a function has access to three variables a, b and c, the function will have access to dictionary style object with its own scope\u200a\u2014\u200acontaining a, b and c.<\/p>\n<p id=\"c8b1\" class=\"graf graf--p graf-after--p\"><strong class=\"markup--strong markup--p-strong\">This dictionary styled object is the function\u2019s lexical environment.<\/strong><\/p>\n<p id=\"922e\" class=\"graf graf--p graf-after--p\">So in our case, both the functions \u201cunused\u201d and \u201csomeMethod\u201d has access to the same lexical environment (or scope). This environment is their closure scope. It is imperative that this scope is shared between all the functions that has access to it.<\/p>\n<p id=\"2e2c\" class=\"graf graf--p graf-after--p\">That means if we have three functions, sample1, sample2 and sample3, all of them are inside a main function named \u201cmainFun\u201d. Imagine that there is a variable a, in the main body of mainFun.<\/p>\n<pre id=\"e647\" class=\"graf graf--pre graf-after--p\">function mainFun()   {<\/pre>\n<pre id=\"fd73\" class=\"graf graf--pre graf-after--pre\">var a = 10;\nvar sample1 = function () {\n              console.log(a);\n              };<\/pre>\n<pre id=\"b59c\" class=\"graf graf--pre graf-after--pre\">var sample2 = function () {\n              console.log(a);\n               };<\/pre>\n<pre id=\"f630\" class=\"graf graf--pre graf-after--pre\">var sample3 = function () {\n               console.log(a);\n               };<\/pre>\n<pre id=\"c77b\" class=\"graf graf--pre graf-after--pre\">                      }<\/pre>\n<p id=\"6ed9\" class=\"graf graf--p graf-after--pre\">The runtime needs to make sure that the three functions sample1, sample2 and sample3 need to have access to the same \u201ca\u201d.<\/p>\n<p id=\"9b34\" class=\"graf graf--p graf-after--p\">This is the same thing that happens in our case with \u201cunused\u201d and \u201csomeMethod\u201d. Both of them share the same lexical scope. Both of them have access to the same \u201coriginalThing\u201d. But as we have already discussed, V8 is smart enough to keep originalThing out of lexical scope (to make them available for GC) if they are not referenced by any functions. This is why the first example doesn\u2019t leak.<\/p>\n<p id=\"43c8\" class=\"graf graf--p graf-after--p\">But as soon as the function \u201cunused\u201d references it, originalThing ends up in the lexical scope, which is not GC\u2019d. This leads to boundless memory leak.<\/p>\n<p id=\"27a9\" class=\"graf graf--p graf-after--p\">This bug was discovered in the Meteor framework.<\/p>\n<p id=\"119d\" class=\"graf graf--p graf-after--p\">How to solve this bug?<\/p>\n<p id=\"1829\" class=\"graf graf--p graf-after--p\">Simple!<\/p>\n<p id=\"4f54\" class=\"graf graf--p graf-after--p\">Just add one single line:<\/p>\n<pre id=\"1763\" class=\"graf graf--pre graf-after--p\">originalThing = null<\/pre>\n<p id=\"897c\" class=\"graf graf--p graf-after--pre\">to the end of replaceThing. This way, after each function iteration, the name originalThing will exist in the lexical scope of someMethod, but there will not be a link to the long string.<\/p>\n<pre id=\"64f0\" class=\"graf graf--pre graf-after--p\">var theThing = null;<\/pre>\n<pre id=\"2989\" class=\"graf graf--pre graf-after--pre\">var replaceThing = function () {\nvar originalThing = theThing;<\/pre>\n<pre id=\"64f6\" class=\"graf graf--pre graf-after--pre\">var unused = function () {<\/pre>\n<pre id=\"cc83\" class=\"graf graf--pre graf-after--pre\">   if (originalThing)\n       console.log(\u201chi\u201d);<\/pre>\n<pre id=\"6c72\" class=\"graf graf--pre graf-after--pre\">     };<\/pre>\n<pre id=\"03ea\" class=\"graf graf--pre graf-after--pre\">theThing = {\n            longStr: new Array(1000000).join(\u2018*\u2019),\n            someMethod: function () {}<\/pre>\n<pre id=\"e9c3\" class=\"graf graf--pre graf-after--pre\">           };<\/pre>\n<pre id=\"2086\" class=\"graf graf--pre graf-after--pre\">originalThing = null;<\/pre>\n<pre id=\"9af5\" class=\"graf graf--pre graf-after--pre\">};<\/pre>\n<pre id=\"abdb\" class=\"graf graf--pre graf-after--pre\">setInterval(replaceThing, 1000);<\/pre>\n<p id=\"8963\" class=\"graf graf--p graf-after--pre\">There you go! So have a nice time until we meet again.<\/p>\n<p id=\"94fd\" class=\"graf graf--p graf-after--p graf--trailing\">This is my learning blog. I write as I learn new things. This blog and codes are inspired from an Original bug discovered in the Meteor\u2019s live HTML template rendering system. The Original blog post is <a class=\"markup--anchor markup--p-anchor\" href=\"https:\/\/blog.meteor.com\/an-interesting-kind-of-javascript-memory-leak-8b47d2e7f156\" target=\"_blank\" rel=\"noopener noreferrer\" data-href=\"https:\/\/blog.meteor.com\/an-interesting-kind-of-javascript-memory-leak-8b47d2e7f156\">here<\/a>.<\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p class=\"excerpt\">One fine day evening, after writing a handful of beautiful JavaScript code, sipping your coffee, you smile\u200a\u2014\u200athe code looks especially\u2026 After reading Inspecting one of the most famous JavaScript bugs of all time one may wonder how such flaws does not &#8220;explode&#8221; in the face of every developer, subtle as it is<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"https:\/\/monodes.com\/predaelli\/2019\/05\/01\/inspecting-one-of-the-most-famous-javascript-bugs-of-all-time\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"link","meta":{"inline_featured_image":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[50],"tags":[],"class_list":["post-5536","post","type-post","status-publish","format-link","hentry","category-javascript","post_format-post-format-link"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p6daft-1ri","jetpack-related-posts":[{"id":8197,"url":"https:\/\/monodes.com\/predaelli\/2021\/02\/25\/a-post-mortem-in-5-acts-of-how-microsoft-privatized-open-source-killing-javascript-in-the-process\/","url_meta":{"origin":5536,"position":0},"title":"A Post-Mortem in 5 Acts, of How Microsoft Privatized Open Source, killing JavaScript in the Process","author":"Paolo Redaelli","date":"2021-02-25","format":"link","excerpt":"A Post-Mortem in 5 Acts, of How Microsoft Privatized Open Source, killing JavaScript in the Process After Microsoft\u2019s blitzkrieg take-over, the Open Source JavaScript community, as we know it, is coming to an end. Alex KleydintsFeb 6\u00b79 min read All things said and done, you must stand in awe, at\u2026","rel":"","context":"In &quot;Ethics&quot;","block_context":{"text":"Ethics","link":"https:\/\/monodes.com\/predaelli\/category\/ethics\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4792,"url":"https:\/\/monodes.com\/predaelli\/2018\/10\/28\/telosys-code-generator-for-java-javascript-python-nodejs-php-c-etc\/","url_meta":{"origin":5536,"position":1},"title":"Telosys code generator for Java, JavaScript, Python, NodeJS, PHP, C#, etc","author":"Paolo Redaelli","date":"2018-10-28","format":false,"excerpt":"Telosys is a free code generator usable with different languages or frameworks : Java, JavaScript, Python, NodeJS, PHP, GoLang, C#, Angular, VueJS, etc Sorgente: Telosys code generator for Java, JavaScript, Python, NodeJS, PHP, C#, etc","rel":"","context":"In &quot;Senza categoria&quot;","block_context":{"text":"Senza categoria","link":"https:\/\/monodes.com\/predaelli\/category\/senza-categoria\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":5254,"url":"https:\/\/monodes.com\/predaelli\/2019\/02\/17\/learn-pure-functions-with-javascript-cristi-salcescu-medium\/","url_meta":{"origin":5536,"position":2},"title":"Learn pure functions with JavaScript \u2013 Cristi Salcescu \u2013 Medium","author":"Paolo Redaelli","date":"2019-02-17","format":"link","excerpt":"Pure functions are easier to read, understand, test, debug and munch more. Source: Learn pure functions with JavaScript \u2013 Cristi Salcescu \u2013 Medium Learn pure functions with JavaScript Cristi Salcescu Feb 10 Photo by Ren\u00e9 Reichelt on\u00a0Unsplash Pure functions are easier to read, understand, test, debug and munch more. You\u2026","rel":"","context":"In &quot;Documentations&quot;","block_context":{"text":"Documentations","link":"https:\/\/monodes.com\/predaelli\/category\/documentations\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4677,"url":"https:\/\/monodes.com\/predaelli\/2018\/10\/22\/conditional-javascript-for-experts-hacker-noon\/","url_meta":{"origin":5536,"position":3},"title":"Conditional JavaScript for Experts \u2013 Hacker Noon","author":"Paolo Redaelli","date":"2018-10-22","format":false,"excerpt":"Mastery of conditional expressions for cleaner codes They say in Conditional JavaScript for Experts \u2013 Hacker Noon. What they are suggesting is to use side-effects of\u00a0 \"expression\", as Javascript does not separate commands and queries. Call me dogmatic but this behavior to look like a fundamental ingredient for disaster. In\u2026","rel":"","context":"In &quot;Eiffel&quot;","block_context":{"text":"Eiffel","link":"https:\/\/monodes.com\/predaelli\/category\/eiffel\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":297,"url":"https:\/\/monodes.com\/predaelli\/2015\/06\/12\/javascript-other-languages\/","url_meta":{"origin":5536,"position":4},"title":"JavaScript + Other Languages","author":"Paolo Redaelli","date":"2015-06-12","format":"link","excerpt":"JavaScript+OtherLanguages Those slides JavaScript + Other Languages are really useful to implement an eventual Eiffel to JavaScript compiler. Well, actually it should be called transcompiler.... We could just feed the C files made by current Liberty compiler but it seems to me that passing throught C which is a procedural\u2026","rel":"","context":"In &quot;Eiffel&quot;","block_context":{"text":"Eiffel","link":"https:\/\/monodes.com\/predaelli\/category\/eiffel\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":5130,"url":"https:\/\/monodes.com\/predaelli\/2019\/01\/15\/intuitive-asynchronous-javascript-edwin-yung-medium\/","url_meta":{"origin":5536,"position":5},"title":"Intuitive Asynchronous Javascript \u2013 Edwin Yung \u2013 Medium","author":"Paolo Redaelli","date":"2019-01-15","format":false,"excerpt":"Escape callback hell! Source: Intuitive Asynchronous Javascript \u2013 Edwin Yung \u2013 Medium \u00a0 Asynchronous Javascript Explained Simply and Intuitively Edwin Yung Dec 29, 2017 Escape callback hell with this\u00a0article! Asynchronous Javascript is difficult to wrangle. The following is my quick attempt to elucidate their inner workings. Before we get started,\u2026","rel":"","context":"In &quot;Documentations&quot;","block_context":{"text":"Documentations","link":"https:\/\/monodes.com\/predaelli\/category\/documentations\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/posts\/5536","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/comments?post=5536"}],"version-history":[{"count":0,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/posts\/5536\/revisions"}],"wp:attachment":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/media?parent=5536"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/categories?post=5536"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/tags?post=5536"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}