VBScript高阶函数 [英] VBScript Higher-Order Functions
本文介绍了VBScript高阶函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法编写匿名函数,并将它们传递给其他函数,并在vbscript中调用它们?
ol>
Is there a way to write anonymous functions, pass them to other functions, in which they are invoked, in vbscript?
解决方案
- There are no anonymous functions/subs/methods in VBScript.
- You can use GetRef() (see sample1, sample2) to get something like a function pointer that can be passed to functions/subs to be invoked there (callback). But there are no closures in VBScript, so tricks possible in other languages fail in VBScript.
- For specific problems that can be solved with higher order functions in functional languages there may be (nearly) equivalent VBScript solutions involving classes/objects; but for discussing that approach you need to describe your/such a problem in detail.
这篇关于VBScript高阶函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文