逻辑上 [英] Logical On

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

问题描述

嗨组,


对小组提出的一个问题,当

旁边有选项时,它会不会让很多用户更好严格的一个选项逻辑严格打开。


我是自动编写Textbox1.text = 0.tostring。我知道它有什么东西

,但我是自动完成的。


我发现这很疯狂,它不能是一个字符串,所以

编译器必须要找到这个非常简单,但对于puritains,比那个

选项,比他们可以设置它。


我认为对于很多VB用户来说这种事情比运营商重载或其他更多C行为更重要

(我理解很多

复杂用户想要它,所以我不会说,不要让它们成功,但

我认为这个Option logical strict on会得到90%的用户

,而运营商超载可能是10%)。


只是一个人吗?


Cor

解决方案

从我的角度来看,你所说的是数字文字是一个

对象,因此有一套方法等。这些方法应该显示

就像他们为所有o做的那样IDE等中的对象。你正在制定一个新的
编译器指令来强制执行正式的转换/转换,因为你把它放在了清教徒中。 - 基本上当编译器指令存在时,

显式执行所有对象类型的转换(通过方法

,如toString())而不是隐式执行。


如果我已正确理解这一点,请不要使用以下代码片段

演示此内容(尽管没有额外的编译器指令)。


Dim cmp As String =" fred"

如果" .CompareTo(cmp)= 0 .....


vs.


如果cmp.CompareTo("")= 0 ....

两个字符串比较在逻辑上等同但前一个绘图

注意String是一个对象的事实。


但是在这里,对象是一个字符串,而不是数字文字。所以,你想要

来为前者提供完整的IDE支持等(你输入

in 0 and up come a set methods etc)等等当编译器指令存在时,编译严格。


如果是,那么0,Long,Integer,Float等,以及什么是默认值<当通过点表示法访问数字

文字的方法时,可以使用
方法(除了toString())?而且,最重要的是,根据数字文字类型的不同,它们会有所不同,如果是这样,编译器知道如何获得



我期待在这个帖子中阅读后续帖子。但是,是的,我确定你提出的建议是什么,如果可以实施的话,将比运营商重载等更通用。


Hexathioorthooxalate

" Cor" < no*@non.com>在留言中写道

新闻:%2 **************** @ TK2MSFTNGP12.phx.gbl ...

嗨组,

对于小组来说,如果旁边有Option strict on,那么对于很多用户来说不是更好的
。一个Option logical Strict on。

我是自动编写Textbox1.text = 0.tostring。我知道它有什么,但我是自动完成的。

我发现这很疯狂,它不能是一个字符串,所以
编译器必须要发现这很容易,但对于puritains而言,比他们可以设置它的选项,我认为对于很多VB用户来说这种事情更重要<比操作符重载或其他更多的C行为(我理解很多高级用户想要它,所以我不会说,不要让他们成功,
但我认为这个选项逻辑严格打开将获得90%的用户
而操作员超载可能达到10%。

只是一个人?

Cor




Hiya Hex,


我不知道你是什么说,但我认为Cor所说的是


选项严格打开

Dim S as String

S = 3' '编译错误


是Option Strict g有点太过分了,

S = 3

应该进行隐式转换(不是后期限制),因为还有什么

<可以>它是什么?


这是你理解并同意的吗?我真的不能说,

我很害怕。


问候,

Fergus


-

(请忽略这个 - 这是一场不和的争斗)

============ ======================================

每日行情

Herfried:

我不需要/想要人工互动。

============= =====================================


< blockquote> *Cor < no*@non.com> scripsit:

对小组提出的一个问题,当
旁边有Option strict on时,不会让很多用户更好。一个Option logical Strict on。

我是自动编写Textbox1.text = 0.tostring。我知道它有什么,但我是自动完成的。

我发现这很疯狂,它不能是一个字符串,所以
编译器必须要找到这个很容易,但对于puritains,而不是那个
选项,比他们可以设置它。




你想跳过''ToString (''''''选项严格打开''的一部分?


-

Herfried K. Wagner

MVP· VB Classic,VB.NET

< http://www.mvps.org/dotnet>


Hi group,

A question to the group, would it not be for a lot of the users better when
there was beside "Option strict on" an "Option logical Strict on".

I was automaticaly writting Textbox1.text = 0.tostring. I know what it has
to be, but I did this automaticly.

I find this crazy, it cannot be something else than a string, so the
compiler must have to find this very easy, but for the puritains, than that
option, than they can set it off.

I think that for a lot of VB users this kind of things is more important
than operator overloading or other more C behaviour (I understand a lot of
sophisticated users want it, so I would not say, don''t let them make it, but
I think that this "Option logical strict on" would get 90% of the users
while operator overloading maybe 10%).

Just a thougth?

Cor

解决方案

From my perspective what you are saying is that a numeric literal is an
object and therefore has a set of methods etc. These methods should show up
as they do for all other objects in the IDE etc. You are mooting a new
compiler directive to enforce formal casting/conversion as you put it for
the "Puritans" - basically when the compiler directive is present,
conversion of types for all objects is performed explicitly (through methods
like toString()) and not implicitly.

If I have understood this correctly, doesn''t the following code snippet
demonstrate this (albeit without an additional compiler directive).

Dim cmp As String = "fred"
If "".CompareTo(cmp)=0 .....

vs.

If cmp.CompareTo("")=0 ....
Both string comparisons being logically equivalent but the former drawing
attention to the fact that a String is an object.

But here, the object is a string, not a numeric literal. So, you are wanting
to make things consistent with full IDE support etc for the former (you type
in 0. and up come a set of methods etc) and more stringent compilation when
the compiler directive is present.

If so, what is 0, a Long, Integer, Float etc, and what set of default
methods are available (other than toString()) when methods for a numeric
literal are accessed through dot notation? And, most importantly, wouldn''t
they be different depending on the numeric literal type and, if so, how
would the compiler know?

I look forward to reading followup posts in this thread. But yes, I am
convinced what you are proposing, if it could be implemented, would be of
more general use than operator overloading and the like.

Hexathioorthooxalate
"Cor" <no*@non.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...

Hi group,

A question to the group, would it not be for a lot of the users better when there was beside "Option strict on" an "Option logical Strict on".

I was automaticaly writting Textbox1.text = 0.tostring. I know what it has
to be, but I did this automaticly.

I find this crazy, it cannot be something else than a string, so the
compiler must have to find this very easy, but for the puritains, than that option, than they can set it off.

I think that for a lot of VB users this kind of things is more important
than operator overloading or other more C behaviour (I understand a lot of
sophisticated users want it, so I would not say, don''t let them make it, but I think that this "Option logical strict on" would get 90% of the users
while operator overloading maybe 10%).

Just a thougth?

Cor




Hiya Hex,

I''m not sure what you''re saying, but I think what Cor is saying is that

Option Strict On
Dim S as String
S = 3 ''Compiler error

is Option Strict going a bit too far and that
S = 3
should do an implicit conversion (not late-bound) because "what else
<could> it be?".

Is that what you understood and were agreeing with? I couldn''t really tell,
I''m afraid.

Regards,
Fergus

--
(Please ignore this - there''s a feud going on)
==================================================
Quote of the day
Herfried:
I don''t need/want human interaction.
==================================================


* "Cor" <no*@non.com> scripsit:

A question to the group, would it not be for a lot of the users better when
there was beside "Option strict on" an "Option logical Strict on".

I was automaticaly writting Textbox1.text = 0.tostring. I know what it has
to be, but I did this automaticly.

I find this crazy, it cannot be something else than a string, so the
compiler must have to find this very easy, but for the puritains, than that
option, than they can set it off.



You would like ro skip the ''ToString()'' part with ''Option Strict On''?

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>


这篇关于逻辑上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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