DefType 语句是否被认为是不好的做法? [英] Are DefType statments considered Bad Practice?

查看:26
本文介绍了DefType 语句是否被认为是不好的做法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望您对为什么或(为什么不)应该(或不应该)使用此语句的想法.

I want your thoughts on why or (why not) this statement should (or should not) be used.

由于这有点主观,这是我的标准:出于具体原因(而不是不合理的意见)给予支持.接受的最终答案将是最全面的答案.

Since this is a little subjective, here is my criteria: Upvotes given for concrete reasons (as opposed to unreasoned opinion). Final answer accepted will be the most comprehensive answer.

推荐答案

在精心设计的程序中,Defxxx 语句毫无意义,因为所有变量和函数都将被显式键入.

In a well-crafted program, Defxxx statements are pointless, because all variables and functions will be explicitly typed.

除了一种情况:DefObj AZ,结合 Option Explicit,使任何无类型或未声明的变量、函数或成员(实际上)不可能存在于您的代码中,并使任何最终会成为 Variant 的东西都脱颖而出.

Except for one case: DefObj A-Z, in conjunction with Option Explicit, makes it (practically) impossible for any untyped or undeclared variable, function, or member to exist in your code, and makes anything that would wind up as a Variant stand out in sharp relief.

DefObj A-Z 是 Option Explicit 腰带的吊带.

DefObj A-Z is the suspenders to Option Explicit's belt.

这篇关于DefType 语句是否被认为是不好的做法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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