VBScipt:调用全局变量的阴影内建函数 [英] VBScipt: Call builtin functions shadowed by global variables

查看:124
本文介绍了VBScipt:调用全局变量的阴影内建函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

上的VBScript ASP经典包含INT功能。 (它舍入到-∞号码。)假设有些过于聪明codeR已经创建了一个名为INT的全局变量。有没有什么办法让在原来的功能?我试着作用域变通方法,并狡猾高管,但没有骰子的所有方式。我怀疑这是不可能的,但我希望有人会知道更多关于它比我做的。

VBScript on ASP Classic contains an "int" function. (It rounds numbers towards -∞.) Suppose that some excessively "clever" coder has created a global variable named "int". Is there any way to get at the original function? I've tried all manner of workarounds with scoping and dodgy execs, but no dice. I suspect that it is impossible, but I'm hoping that someone will know more about it than I do.

编辑:感谢您的答复。既然你们都问,全局变量,所谓的内部(虽然不幸的是,VBScript是不区分大小写),是类似于Java的整数的类工厂。默认的属性基本上是一个参数的构造函数;即INT(42)产生了新的IntClass对象容纳42 IntClass又将默认属性只是返回原始号码。

Thanks for the responses. Since y'all asked, the global variable, called "Int" (though unfortunately, vbscript is not case-sensitive), is a factory for a class similar to Java's Integer. The default property is essentially a one-arg constructor; i.e. "Int(42)" yields a new IntClass object holding 42. The default property of IntClass in turn simply returns the raw number.

创作者试图解决缺乏适当的命名空间和静态方法和解决方案的实际pretty浑然一体。通过在一个int预计的IntClass,它会自动触发的默认属性。我试图修补剩下的最后缝:外部code调用INT不会正确地圆(因为构造函数使用CLng函数)

The creator was trying to work around the lack of proper namespaces and static methods, and the solution's actually pretty seamless. Pass in an IntClass where an int is expected and it will automatically trigger the default property. I'm trying to patch the last remaining seam: that external code calling "int" will not round properly (because the constructor uses CLng).

推荐答案

不,我知道的,getref仅适用于自定义函数,而不是构建插件。我建议重命名custom'int功能,并更新到这个自定义的所有引用。您可以使用搜索功能的Visual Studio(如preSS),或者您喜欢这个的任何其他工具。应该不会是太大的工作。

Not that I know of, getref only works on custom functions not on build-ins. I would suggest renaming the custom'int' function and update all references to this custom ones. You can use the search function visual studio (express) or any other tool of your liking for this. Shouldn't be to much work.

这篇关于VBScipt:调用全局变量的阴影内建函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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