VBScript高阶函数 [英] VBScript Higher-Order Functions

查看:132
本文介绍了VBScript高阶函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法编写匿名函数,并将它们传递给其他函数,并在vbscript中调用它们?

ol>
  • VBScript中没有匿名函数/ subs /方法。
  • 您可以使用GetRef()(请参阅 sample1 sample2 )来获取类似于函数指针的东西可以传递给在那里调用的函数/子类(回调函数)。但是在VBScript中没有关闭,因此其他语言中可能出现的技巧在VBScript中失败。

  • 对于特定的问题,可以用函数语言中的高阶函数来解决可能存在(近乎)相同的涉及类/对象的VBScript解决方案;但为了讨论这种方法,你需要详细描述你的问题。


  • Is there a way to write anonymous functions, pass them to other functions, in which they are invoked, in vbscript?

    解决方案

    1. There are no anonymous functions/subs/methods in VBScript.
    2. 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.
    3. 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屋!

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