arguments.callee有什么问题? [英] What's wrong with arguments.callee ?

查看:57
本文介绍了arguments.callee有什么问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为何列在此处:

http ://www.crockford.com/javascript/recommend.html


在弃用下?


没有它,匿名函数()如何自称为

(递归)?


我用来写这样的计时器:


setTimeout(function(){

(...)

setTimeout( arguments.callee,ms);

},ms);


如果没有arguments.callee我怎么说这样做?


谢谢,

-

Jorge。

Why is it listed here :

http://www.crockford.com/javascript/recommend.html

under "deprecation" ?

Without it, how is an anonymous function() going to call itself
(recursively) ?

I use to write timers like this :

setTimeout( function () {
(...)
setTimeout( arguments.callee, ms );
}, ms );

How am I suppossed to do that without arguments.callee ?

Thanks,
--
Jorge.

推荐答案

Jorge < jo *** @ jorgechamorro.comwrites:
Jorge <jo***@jorgechamorro.comwrites:

为什么列在这里:

http://www.crockford.com/javascript/recommend.html

弃用下的

Why is it listed here :

http://www.crockford.com/javascript/recommend.html

under "deprecation" ?



我真的不知道。

I really don''t know.


没有它,匿名函数怎么样()打电话给自己

(递归)?
Without it, how is an anonymous function() going to call itself
(recursively) ?



查找Y组合器。

http://en.wikipedia.org/wiki/Y_combinator
http://javascript.crockford.com/little.html


函数Y(le){

返回函数(f){

返回f(f);

}(函数(f){

return le( function(x){

return f(f)(x);

});

});

}


-

Joost Diepenmaat |博客: http://joost.zeekat.nl/ |工作: http://zeekat.nl/

Look up the Y combinator.

http://en.wikipedia.org/wiki/Y_combinator
http://javascript.crockford.com/little.html

function Y(le) {
return function (f) {
return f(f);
}(function (f) {
return le(function (x) {
return f(f)(x);
});
});
}

--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/

Joost Diepenmaat写道:
Joost Diepenmaat wrote:

Jorge< jo *** @ jorgechamorro.comwrites:
Jorge <jo***@jorgechamorro.comwrites:

>为何列在此处:

http://www.crockford.com/javascript/recommend.html

在弃用下?
>Why is it listed here :

http://www.crockford.com/javascript/recommend.html

under "deprecation" ?



我真的不知道。


I really don''t know.


>没有它,匿名函数怎么样? ()打电话给自己
(递归)?
>Without it, how is an anonymous function() going to call itself
(recursively) ?



查找Y组合器。

http://en.wikipedia.org/wiki/Y_combinator
http://javascript.crockford.com/little.html


函数Y(le){

返回函数(f){

返回f(f);

}(函数(f){

return le( function(x){

return f(f)(x);

});

});

}


Look up the Y combinator.

http://en.wikipedia.org/wiki/Y_combinator
http://javascript.crockford.com/little.html

function Y(le) {
return function (f) {
return f(f);
}(function (f) {
return le(function (x) {
return f(f)(x);
});
});
}



阅读完链接并尝试理解

以上的功能后出现了一个问题:为什么不呢

使用非匿名函数而不是匿名函数?


After reading the links and trying to understand the
above function a question arose: why not
use a non-anonymous function instead of anonymous?



9月14日,12:04 * pm,optimistx < optimistxPoi ... @ poistahotmail.com>

写道:
On Sep 14, 12:04*pm, "optimistx" <optimistxPoi...@poistahotmail.com>
wrote:

>

阅读完链接并尝试理解

以上函数
>
After reading the links and trying to understand the
above function



您是否得到了它? (我仍然没有)。

And did you get it ? (I still don''t).


a *问题出现了:为什么不用

使用非匿名函数而不是匿名函数?
a *question arose: why not
use a non-anonymous function instead of anonymous?



是的,这是一个解决方案,一个不必要地浪费一个符号名称

(functionName),而且,arguments.callee是100%明确,

而functionName可能没有。


无论如何,出于好奇,他们为什么要摆脱它?


-

Jorge。

Yes, that''s a solution, one that needlessly wastes a symbol name
(functionName), and furthermore, arguments.callee is 100% unambiguous,
while functionName might not.

Anyhow, just out of curiosity, why do they want to get rid of it ?

--
Jorge.


这篇关于arguments.callee有什么问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆