C#语言建议 [英] C# Language Suggestions

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

问题描述

您好,


我明白这是发布建议的好地方

关于语言的未来变化,以及

开发C#的微软开发人员阅读这个新闻组。

如果有更合适的地方发布,请

让我知道。所以,这里有一些我想看的东西。


1.一种将局部变量声明为只读的方法。


2.一种定义静态变量的方法,这些变量只能在给定函数中访问,例如在C ++中。

这是一种很好的信息隐藏形式,有助于把

定义放在他们附近使用,并减少

级别的混乱。

Andrew

解决方案

Andrew,

所以,这里有一些我想看的东西。

1.一种将局部变量声明为只读的方法。

2.一种定义只能从给定函数中访问的静态变量的方法,如在C ++中。



我不反对这两个

建议的申请结果。


但是,我想知道为什么需要更改C#语言?


v ersus


设计你的应用程序以提供这个功能?


例如,对于一个只读局部变量 - 我认为这意味着它的

值是常量,因为它是只读的。那么,为什么不实现一个返回常量值的方法

?如果你想设置一次,为什么不用
实现一个使用延迟初始化的方法?或者为什么不......?哪一种取决于你真正需要的品质。


对于仅在给定函数中可访问的静态 - 为什么不设计

申请要做到这一点?只能从该函数访问静态。


我想我没有看到额外语法的复杂性由

平衡功能的价值。它必须是我邪恶的Smalltalk方面显示

通过。 Smalltalk是一种纯粹的OO语言,只需要手动填写

语法和关键词(10左右)即可学习。


这需要一些真正的好处语法根本没有语法!


问候,


兰迪


"安德鲁" <关于******** @ nospam.onezero.org>在留言中写道

news:00 **************************** @ phx.gbl ... < blockquote class =post_quotes> 1.一种将局部变量声明为只读的方法。


这不是常数吗?

2.一种定义只能从给定函数中访问的静态变量的方法,就像在C ++中一样。
这是一种很好的信息隐藏形式,有助于将
定义放在其使用附近,并减少
类中的混乱。



这样会很好。


问候,

Michael Culley


你好,


这是一个很好的起点,但我也建议你去
http://www.gotdotnet.com/team/csharp...e/default.aspx />
将看到该语言的新提议功能


1.一种将局部变量声明为只读的方法。
喜欢什么?

如果你的意思是参数的const修饰符,这里已经讨论了

之前,请看看档案:

2.一种定义静态变量的方法,这些变量只能在给定函数中访问,就像在C ++中一样。


这是一个好主意,但如果再考虑一下,你会看到

静态功能是从C继承的一种封装方式,

那里变量的另一种可能方式是全局的,用OOP语言你可以定义一个私有成员,我知道它不是同样但是IMHO

它已经足够了,不会少于你有一个大班或几个开发人员

在同一个班级工作应该没问题。

我认为设计一种语言最困难的决定不是什么包括但是遗漏了什么(我记得我从我的

编程中听到了这句话语言的大学教师Miguel Katrib,如果你包括

其他语言的所有功能,你将以胖胖的
编译器和困难的语言结束。


那是我的两分钱;)


干杯,


-

Ignacio Ma下巴,

ignacio.machin AT dot.state.fl.us

佛罗里达州交通局


" Andrew" <关于******** @ nospam.onezero.org>在留言中写道

新闻:00 **************************** @ phx.gbl ...你好,

我知道这是发布有关该语言未来变化的建议的好地方,而且开发C#的Microsoft开发人员阅读了这个新闻组。
如果有更合适的地方发布,请
告诉我。所以,这里有一些我想看的东西。

1.一种将局部变量声明为只读的方法。

2.一种定义的方法只能在给定函数中访问的静态变量,例如在C ++中。
这是一种很好的信息隐藏形式,有助于将
定义放在其使用附近,并减少
class。

Andrew



Hello,

I understand that this is a good place to post suggestions
about future changes to the language, and that the
Microsoft developers who develop C# read this newsgroup.
If there is a more appropriate place to post this, please
let me know. So, here are a few things I''d like to see.

1. A way to declare a local variable as being readonly.

2. A way to define static variables that are only
accessible from within a given function, like in C++.
This is a nice form of information hiding, helps put
definitions near their use, and reduces clutter in the
class.
Andrew

解决方案

Andrew,

So, here are a few things I''d like to see.

1. A way to declare a local variable as being readonly.

2. A way to define static variables that are only
accessible from within a given function, like in C++.



I am not against the results achieved in an application from these two
suggestions.

However, I wonder why changes to the C# language are required?

versus

Designing your application to provide this functionality?

For example, for a readonly local variable -- I assume this means that its
value is constant because it is readonly. Then, why not implement a method
that returns the constant value? If you want to set it once, why not
implement a method that uses lazy initialization? Or why not ...? Which
approach one takes depends on what qualities one really needs to have.

For statics only accessible in a given function -- why not design the
application to do just that? Only access the statics from that function.

I guess I don''t see that the complexity of additional syntax is balanced by
the value of the functionality. It must be my evil Smalltalk side showing
through. Smalltalk is a pure OO language that has only a hand-full of
syntax and keywords (10 or so) to learn.

It takes some real good syntax to beat no syntax at all!

Regards,

Randy


"Andrew" <as********@nospam.onezero.org> wrote in message
news:00****************************@phx.gbl...

1. A way to declare a local variable as being readonly.
Isn''t that a constant?
2. A way to define static variables that are only
accessible from within a given function, like in C++.
This is a nice form of information hiding, helps put
definitions near their use, and reduces clutter in the
class.



That would be good.

Regards,
Michael Culley


Hi,

This is a good place to start, but Iwould also suggest you to go to
http://www.gotdotnet.com/team/csharp...e/default.aspx there you
will see the new proposed features of the language


1. A way to declare a local variable as being readonly. Like what?
If you mean the const modificator to a parameter it has been discussed here
before, take a look at the archives:
2. A way to define static variables that are only
accessible from within a given function, like in C++.
This would be a good idea, but if take a second think about it you see that
the static functionality was inherited from C as a way of encapsulation,
there the other possible way of a variable was global, in a OOP language you
can define a private member of the class, I know it''s not the same but IMHO
it''s enough , un less that you have a big class or several developers
working in the same class it should be ok.
I think that the most difficult decision in designing a language is not
what include but what is left out ( I remember I hear this phrase from my
programming language''s teacher in the univ, Miguel Katrib ) , if you include
all the functionality that other languages have you will end with a fat
compiler and a difficult language.

those were my two cents ;)

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Andrew" <as********@nospam.onezero.org> wrote in message
news:00****************************@phx.gbl... Hello,

I understand that this is a good place to post suggestions
about future changes to the language, and that the
Microsoft developers who develop C# read this newsgroup.
If there is a more appropriate place to post this, please
let me know. So, here are a few things I''d like to see.

1. A way to declare a local variable as being readonly.

2. A way to define static variables that are only
accessible from within a given function, like in C++.
This is a nice form of information hiding, helps put
definitions near their use, and reduces clutter in the
class.
Andrew



这篇关于C#语言建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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