åã« lambda lifting ã¨ããè¨èãèãã¦ããããã£ã¨å¦æ³ãã¦ããã®ã¯ãã¯ãã¼ã¸ã£ã¨ãªãã¸ã§ã¯ãã¯ãä¼¼ã¦ãããã®ã§ã¯ãªããåãç©ããªã®ã§ã¯ãªããã¨ããäºãlambda lifting ã¨ããã®ã¯ã¯ãã¼ã¸ã£ãã³ã³ããã¼ã¿ã«å¤å½¢ããæä½ã®äºã§ãå¤åç°¡åã«æ¸ãã°
function f() { var a = 1 return function() { return a * 2 } }
ã®ãããªé¢æ°ã
function g(env) { return env.a * 2; } function f() { var a = 1 return g({a: 1}); }
ã®ããã«æ¸ãç´ãã¦ã¹ã³ã¼ããã¾ããã a ã®ãããªå¤æ°ã¢ã¯ã»ã¹ãç¡ããäºã ã¨æãã¾ããã§ããããªããã«ä¼¼ã¦ããªã¼ã¨æã£ããããªãã¸ã§ã¯ãæåè¨èªã®ã¡ã½ããã«ãã£ããã§ããpython ã perl ã®ãããªè¨èªã§ã¯ã¬ã·ã¼ãã第ä¸å¼æ°ã«æ¸ãã¾ãããããã¯ãjavascript ã¿ããã«æé»ã«å®ç¾©ããã this ã lambda lifting ãã¦ããã¨èããäºãåºæ¥ã¾ãã
ã¨ããäºã§ãã¯ãã¼ã¸ã£ã®ç°å¢ã¨ãªãã¸ã§ã¯ãè¨èªã®ã¬ã·ã¼ããåãç©ã ã¨è¦ãªãäºã§ãããç¾ããè¨èªãåºæ¥ãã®ã§ã¯ç¡ããã¨èãã¦ãã¾ãããã ããªãã¸ã§ã¯ãã«ã¯åãé¢æ°ã§ããªãã¸ã§ã¯ãã«ãã£ã¦å¥ã®é¢æ°å®ä½ãå¼ã°ããã¡ã½ãããã£ã¹ããããããã®ã§ç°¡åã«ã¯è¡ãã¾ããããã®è¾ºããã¡ãã£ã¨èãã¾ãã
追è¨
id:SaitoAtsushi ããã«ãã®ã¾ã¾ãºããªã®è¨äºãæãã¦é ããã®ã§ãªã³ã¯ãè²¼ãã¾ããããã¯é¢ç½ãã§ãï¼