Re: C# 3.0 Proposals

Tech-Archive recommends: Fix windows errors by optimizing your registry




"Demetri" <Demetri@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:3CB651CD-6B01-4CBD-922B-3CF0306236A5@xxxxxxxxxxxxxxxx
Where can I go to state my views for or against some of the C# 3.0 proposals?

They are listed here:

http://download.microsoft.com/download/5/8/6/5868081c-68aa-40de-9a45-a3803d8134b8/CSharp_3.0_Specification.doc

For one thing, I can not believe they are trying to convert C# to VB by
making it a non-type safe language. For an example of what I mean read this
excerpt from the doc:

"26.1 Implicitly typed local variables
In an implicitly typed local variable declaration, the type of the local
variable being declared is inferred from the expression used to initialize
the variable. When a local variable declaration specifies var as the type and
no type named var is in scope, the declaration is an implicitly typed local
variable declaration. For example:

var i = 5;
var s = "Hello";
var d = 1.0;
var numbers = new int[] {1, 2, 3};
var orders = new Dictionary<int,Order>();"

I don't know about you guys, but that just smells too much like VB's variant
type. NASTY!!

--
-Demetri

I see this mis-conception by a lot of developers. It is *NOT* an untyped variable (variant). Those are, in face, typed. For example:

var i = 5;

This creates i as an integer and assigns the integer 5 to it. If you later decide to assign a string, or other non-integral data to it, then you would get a type exception.

var i = 5;
i = "test"; <-- results in an exception being thrown because you can't assign a string to an integer.

If you read further about the language integrated query stuff, you should see that the "var" keyword is something that is needed for LIQ to function properly :)

HTH,
Mythran

.



Relevant Pages

  • Re: C# 3.0 Proposals
    ... it is nothing like vb's variant type. ... "26.1 Implicitly typed local variables ... In an implicitly typed local variable declaration, ... When a local variable declaration specifies var as the type ...
    (microsoft.public.dotnet.languages.csharp)
  • Bookmark Macro throwing errors
    ... Const varDuplicateName As String _ ... 'Variable declaration ... Dim BookmarkName As String ... Dim var As Word.Variable ...
    (microsoft.public.word.vba.general)
  • Re: Calculate the string statement
    ... verkn:(vkn:char; ... funkt:(fkt:string; ... var fkt,dfkt: p; ... var fehler: boolean; ...
    (comp.lang.pascal.borland)
  • Two new tests for MM B&V
    ... var RunningThreads: Integer; ... class function TStringThreadTest.GetBenchmarkDescription: string; ... function CheckPattern(const Dest: Pointer; const Size: Integer; const ...
    (borland.public.delphi.language.basm)
  • server-side JavaScript: Prototypes of built-in classes, objects and functins
    ... Session object (disk-based session variables for data persistence ... File class (manipulation of files on server, ie. open, close, read, ... //Methods Cgi.queryCgi.postCgi.anyby default return an empty string if requested var not found ...
    (comp.lang.javascript)