logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Re: C# 3.0: msg#00123

windows.devel.dotnet.cx

Subject: Re: C# 3.0

As I noted in my blog entry I'm a bit out of touch on some of the
rationale, but I can give some insight (I hope...). All the additions
are there to make the Linq stuff work (there may be other 3.0 additions
not related as well).

Well, the problem with object instead of var is that you end up with a
weakly-typed implementation. For example:

List products = GetProductList();

object productInfos =
from p in products
select new {p.ProductName, p.Category, Price = p.UnitPrice};

What can I do with productInfos? I don't have the name of a type to cast
it to, so the best I can do is access the values through reflection.

With the var syntax, I get something that's strongly typed, and I can
get IntelliSense on the instance when I want to access the values.

It is possible (or at least it was going to be possible - not sure if it
is) to use a real type if you want to pass that type around (ie
something like EmployeeContactInfo with just an employee ID, a name, and
a phone), but in many cases you don't care about doing that.

Extension methods are mostly there to support the query expressions. The
"select" part of the query expression is, IIRC, implemented using a
query expression.

Eric

-----Original Message-----
From: Discussion relating to the specifics of the C# and Managed C++
languages [mailto:DOTNET-CX@xxxxxxxxxxxxxxxxxxx] On Behalf Of Peter
Ritchie
Sent: Thursday, September 15, 2005 10:34 AM
To: DOTNET-CX@xxxxxxxxxxxxxxxxxxx
Subject: Re: [DOTNET-CX] C# 3.0

Eric Gunnerson has some ramblings at
http://blogs.msdn.com/ericgu/archive/2005/09/14/466510.aspx, on
implicitly types variables and extension methods. I don't buy the
justification of these two additions.

I don't see the need for implicitly typed variables. The note in the
spec. that basically suggests avoiding implicitly typed variables
whenever possible says it all. What's wrong with "Object"? I have the
same opinion on extensions that require "var": Anonymous Types and
Implicitly Types Arrays

Extension methods seems to be a hack to recover from lack (or removal,
considering C++ roots) of nonmember functions or implicit conversion
constructors. It also reaks of a means to circumvent Sealed classes. I
started a blog some months ago on extending C# classes without touching
the base; but never posted it. You can accomplish what extension
methods give you very simply.

The additional object initializers seem to be just syntactic sugar to
avoid having to write constructors.

I don't know what I think about Query Expressions yet.

The only compelling additions, in my opinion, seem to be Collection
Initializers and Lambda Expressions. Lambda Expressions remind me of
Continuation Passing Style.

http://www.peterRitchie.com/

On Wed, 14 Sep 2005 15:52:36 -0500, Russell Collins
<RCollins@xxxxxxxxxxxxxxxxxxx> wrote:

>I couldn't agree more.
>
>-----Original Message-----
>From: Stoyan Damov [mailto:stoyan.damov@xxxxxxxxx]
>Sent: Wednesday, September 14, 2005 9:25 AM
>To: DOTNET-CX@xxxxxxxxxxxxxxxxxxx
>Subject: Re: [DOTNET-CX] C# 3.0
>
> On 9/14/05, Eyvind Axelsen <eyvind.axelsen@xxxxxxxxxx> wrote:
>>
>> Language specification, examples etc can be found here:
>> http://msdn.microsoft.com/vcsharp/future/default.aspx
>>
>> Very cool!
>>
>> Eyvind.
>
> I think I'm going to puke:
> The implictly typed local variables and arrays extension is letting
> lazy
bastards write JavaScript in C#.
> The object initializers extension is something which I expected in C#
1.0.
> The collection intializers extension is useless, and can only serve
> book
writers write contrived examples.
> The anonymous types extension is a replacement of a worst practice,
which is returning a quick-and-dirty tupple (tripplet, whatever). We
used to return object[] for doing that.
> The lamda functions extension is for lazy bastards, which also like to
write write-only code.
> The query expressions extension is, well, no comment. Really, this is
CSql, not C#.
> I would really appreciate a slightly more powerful generics to all of
the "extensions" above.
> Cheers,
>Stoyan
> P.S. Haven't had much sleep recently
>
>===================================
>This list is hosted by DevelopMentor(r) http://www.develop.com
>
>View archives and manage your subscription(s) at
http://discuss.develop.com
>
>===================================
>This list is hosted by DevelopMentor(r) http://www.develop.com
>
>View archives and manage your subscription(s) at
http://discuss.develop.com

===================================
This list is hosted by DevelopMentor(r) http://www.develop.com

View archives and manage your subscription(s) at
http://discuss.develop.com

===================================
This list is hosted by DevelopMentor® http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
qnx.openqnx.dev...    gcc.libstdc++.c...    solaris.opensol...    information-ret...    misc.misterhous...    web.catalyst.ge...    apache.webservi...    redhat.release....    hardware.lirc/2...    kernel.autofs/2...    technology.sust...    linux.vdr/2003-...    editors.lyx.gen...    org.user-groups...    netbsd.devel.pk...    xdg.devel/2004-...    version-control...    jakarta.slide.d...    debian.packages...    creativecommons...    ports.ppc.embed...    bug-tracking.bu...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation