VB“呼叫”语法与命令式语法 [英] VB "Call" syntax vs command-style syntax
问题描述
我正在寻找编码风格的意见。
在我看来,大多数VB / VBA编码器都使用命令式语法
在特定的上下文中调用subs或函数被视为subs ...
Foo" ABC",varDest
偶尔,我看到代码使用Call语法代替。
调用Foo(ABC,varDest)
我曾经发现这很奇怪,但现在,我想知道它是不是真的是优质的风格。基本上,我发现自己开始使用命名参数
更多(无论什么参数必须通过
查看调用行,并不是很明显),以及我认为在这些情况下Call更容易阅读。所以,
确实是一致的,我想我可能会在所有情况下都开始使用Call。
Foo Src:=" ABC", Dest:= varDest
vs
Call Foo(Src:=" ABC",Dest:= varDest)
您的想法?
I''m looking for coding style opinions.
It looks to me like most VB/VBA coders use the command-style syntax for
calling subs or functions being treated as subs in a particular context ...
Foo "ABC", varDest
Occasionally, I see code using the Call syntax instead.
Call Foo("ABC", varDest)
I used to find that wierd, but now, I''m wondering if it isn''t really the
superior style. Basically, I find myself starting to use named parameters
more (whenever it isn''t blatantly obvious what the parameters must be by
looking at the call line), and I think Call reads easier in these cases. So,
do be consistent, I''m thinking I might just start using Call in all cases.
Foo Src:="ABC", Dest:=varDest
vs
Call Foo(Src:="ABC", Dest:=varDest)
Your thoughts?
推荐答案
" Steve Jorgensen" <无**** @ nospam.nospam>在消息中写道
news:j5 ******************************** @ 4ax.com ...
"Steve Jorgensen" <no****@nospam.nospam> wrote in message
news:j5********************************@4ax.com...
我正在寻找编码风格的意见。
在我看来,大多数VB / VBA编码器都使用命令式语法
调用subs或函数在特定上下文中被视为subs $ $ $ $ ....
Foo" ABC",varDest
偶尔,我会看到使用Call语法的代码。
打电话给Foo(ABC,varDest)
我曾经发现那很奇怪,但现在,我想知道它是不是真的<优越的风格。基本上,我发现自己开始更多地使用命名的
参数(无论何时通过查看调用线并不明显显示参数必须是什么),我认为在这些情况下Call更容易阅读。
所以,要保持一致,我想我可能只是开始使用Call in all
I''m looking for coding style opinions.
It looks to me like most VB/VBA coders use the command-style syntax for
calling subs or functions being treated as subs in a particular context ....
Foo "ABC", varDest
Occasionally, I see code using the Call syntax instead.
Call Foo("ABC", varDest)
I used to find that wierd, but now, I''m wondering if it isn''t really the
superior style. Basically, I find myself starting to use named parameters more (whenever it isn''t blatantly obvious what the parameters must be by
looking at the call line), and I think Call reads easier in these cases. So, do be consistent, I''m thinking I might just start using Call in all
的情况。
我总是使用Call。似乎更多的自我记录给我。
-
我没有查看附加的电子邮件帐户
到此消息。发送给... ...
在Hunter dot com的RBrandt
cases.
I''ve always used Call. Seems more self-documenting to me.
--
I don''t check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
2004年7月30日星期五16:00:29 GMT,Steve Jorgensen
< no **** @ nospam.nospam>写道:
一旦你在VB.NET中编写代码,你将不得不学习它
在VBA环境中,我发现打电话更类似于函数调用,
因此我喜欢它。
-Tom。
On Fri, 30 Jul 2004 16:00:29 GMT, Steve Jorgensen
<no****@nospam.nospam> wrote:
You''ll have to un-learn it once you write code in VB.NET
In the VBA environment I find Call more similar to function calls, and
I like it for that reason.
-Tom.
我正在寻找编码风格的意见。
在我看来,大多数VB / VBA编码器都使用命令式语法来调用被视为sub或函数的子函数在一个特定的上下文中的子...
Foo" ABC",varDest
偶尔,我会看到使用Call语法的代码。
打电话给Foo(ABC,varDest)
我曾经发现这很奇怪,但是现在,我想知道它是不是真的是优越的风格。基本上,我发现自己开始更多地使用命名参数(每当看到调用线时参数必须明显不明显时),我认为在这些情况下调用更容易。所以,
确实是一致的,我想我可能会在所有情况下都开始使用Call。
Foo Src:=" ABC",Dest:= varDest
vs
调用Foo(Src:=" ABC",Dest:= varDest)
你的想法?
I''m looking for coding style opinions.
It looks to me like most VB/VBA coders use the command-style syntax for
calling subs or functions being treated as subs in a particular context ...
Foo "ABC", varDest
Occasionally, I see code using the Call syntax instead.
Call Foo("ABC", varDest)
I used to find that wierd, but now, I''m wondering if it isn''t really the
superior style. Basically, I find myself starting to use named parameters
more (whenever it isn''t blatantly obvious what the parameters must be by
looking at the call line), and I think Call reads easier in these cases. So,
do be consistent, I''m thinking I might just start using Call in all cases.
Foo Src:="ABC", Dest:=varDest
vs
Call Foo(Src:="ABC", Dest:=varDest)
Your thoughts?
" Steve Jorgensen" <无**** @ nospam.nospam>在消息中写道
news:j5 ******************************** @ 4ax.com ...
"Steve Jorgensen" <no****@nospam.nospam> wrote in message
news:j5********************************@4ax.com...
我正在寻找编码风格的意见。
在我看来,大多数VB / VBA编码器都使用命令式语法
调用subs或函数在特定上下文中被视为subs $ $ $ $ ....
Foo" ABC",varDest
偶尔,我会看到使用Call语法的代码。
打电话给Foo(ABC,varDest)
我曾经发现那很奇怪,但现在,我想知道它是不是真的<优越的风格。基本上,我发现自己开始更多地使用命名参数(每当看到调用线时参数必须明显不明显时),我认为在这些情况下调用更容易。
所以,要保持一致,我想我可能会在所有情况下都开始使用Call。
Foo Src:=" ABC",Dest:= varDest
vs
调用Foo(Src:=" ABC",Dest:= varDest)
您的想法?
I''m looking for coding style opinions.
It looks to me like most VB/VBA coders use the command-style syntax for
calling subs or functions being treated as subs in a particular context ....
Foo "ABC", varDest
Occasionally, I see code using the Call syntax instead.
Call Foo("ABC", varDest)
I used to find that wierd, but now, I''m wondering if it isn''t really the
superior style. Basically, I find myself starting to use named parameters
more (whenever it isn''t blatantly obvious what the parameters must be by
looking at the call line), and I think Call reads easier in these cases. So, do be consistent, I''m thinking I might just start using Call in all cases.
Foo Src:="ABC", Dest:=varDest
vs
Call Foo(Src:="ABC", Dest:=varDest)
Your thoughts?
打电话给foo种族主义者。我不是叫jorgensen真的吗?
* Sherwood Wang MVP *
call foo racist. i not call jorgensen true?
*Sherwood Wang MVP*
这篇关于VB“呼叫”语法与命令式语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!