类型推断 [英] Type inference

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

问题描述

人们在这里怎么看待VB2008能够推断类型?

例如你现在可以说Dim i = 5

这会创建一个整数


就个人而言,我不喜欢它,因为它不一致,可能会混淆

其他devleopers阅读。

极端的例子 - 下面的x是什么类型的?

dim x = 4294967295


它也会导致不一致 - 有时你必须声明类型和

有时候你不用。


我将使用Option Infer Off


Guy

What do people here think about VB2008 having the ability to infer type?
e.g you can now say Dim i=5
which will create i as an integer

Personally I do not like it as it is not consistent and may be confusing for
other devleopers to read.
Extreme example - what is the type of x below?
dim x= 4294967295

It also leads to inconsistency - sometimes you have to declare the type and
sometimes you dont.

I will be using Option Infer Off

Guy

推荐答案

" guy" < gu*@discussions.microsoft.comschrieb
"guy" <gu*@discussions.microsoft.comschrieb

人们在这里怎么看待VB2008有能力推断

类型?例如,你现在可以说Dim i = 5

这将创建一个整数


我个人不喜欢它因为它不一致而且可能是

混淆其他devleopers阅读。

极端的例子 - 下面的x是什么类型的?

dim x = 4294967295


它也会导致不一致 - 有时你必须申报

类型,有时你不会。


我将使用选项推断关闭
What do people here think about VB2008 having the ability to infer
type? e.g you can now say Dim i=5
which will create i as an integer

Personally I do not like it as it is not consistent and may be
confusing for other devleopers to read.
Extreme example - what is the type of x below?
dim x= 4294967295

It also leads to inconsistency - sometimes you have to declare the
type and sometimes you dont.

I will be using Option Infer Off



我完全同意。了解数据类型是非常基础和重要的

表面处理它们。 (我想知道是谁要求这样的功能)

Armin

I totally agree. Being aware of data types is much too basic and important
to deal with them superficially. (I wonder who asked for such a feature)
Armin


这里的人们怎么看待VB2008有能力推断
What do people here think about VB2008 having the ability to infer

类型?
type?



我不得不说我不介意。

I have to say I don''t mind it.


例如你现在可以说Dim i = 5

这将创建i作为整数
e.g you can now say Dim i=5
which will create i as an integer


我个人不喜欢它,因为它不一致可能是

混淆其他devleopers阅读。
Personally I do not like it as it is not consistent and may be
confusing for other devleopers to read.



什么不一致?

What''s not consistent?


极端的例子 - 什么是类型下面的x是什么?

dim x = 4294967295
Extreme example - what is the type of x below?
dim x= 4294967295



无论什么数字类型都是nessecary存储4294967295.


我认为它(类型推断)可以降低页面上的噪音,而且我看不到

我们通过使用它会失去很多。


-

Rory

Whatever numeric type is nessecary to store 4294967295.

I think it (Type inference) reduces noise on the page and I don''t see that
we''re loosing much by using it.

--
Rory


11月19日上午7:27,Armin Zingler < az.nos ... @ freenet.dewrote:
On Nov 19, 7:27 am, "Armin Zingler" <az.nos...@freenet.dewrote:

" guy" < g ... @ discussion.microsoft.comschrieb
"guy" <g...@discussions.microsoft.comschrieb

人们在这里怎么看待VB2008有能力推断

类型?例如,您现在可以说Dim i = 5

这将创建i作为整数
What do people here think about VB2008 having the ability to infer
type? e.g you can now say Dim i=5
which will create i as an integer


我个人不喜欢它因为它不一致,可能是其他开发人员难以阅读的b $ b。

极端的例子 - 下面的x是什么类型的?

dim x = 4294967295
Personally I do not like it as it is not consistent and may be
confusing for other devleopers to read.
Extreme example - what is the type of x below?
dim x= 4294967295


它也会导致不一致 - 有时你必须声明

类型,有时你不会。
It also leads to inconsistency - sometimes you have to declare the
type and sometimes you dont.


我将使用Option Infer Off
I will be using Option Infer Off



我完全同意。了解数据类型是非常基础和重要的

表面处理它们。 (我想知道是谁要求这样的功能)


Armin


I totally agree. Being aware of data types is much too basic and important
to deal with them superficially. (I wonder who asked for such a feature)

Armin



类型推断是支持LINQ所必需的。这是因为它将
添加到C#中的原因相同。所以,虽然我看到了滥用的巨大潜力 - 我希望它会被明智地使用。


-

汤姆谢尔顿

Type Inference is necessary to support LINQ. It''s the same reason it
is being added to C#. So, while I see a big potential for abuse - I
hope that it will be used judiciously.

--
Tom Shelton


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

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