Re: c# v3.0: implicit variable declaration, why?
- From: "Frans Bouma [C# MVP]" <perseus.usenetNOSPAM@xxxxxxxxx>
- Date: Thu, 21 Sep 2006 01:44:05 -0700
Ignacio Machin ( .NET/ C# MVP ) wrote:
It was something that was required in order to implement LINQ. As a
matter of fact almost all of the 3.0 additions ( like extender
methods) are included to make LINQ works.
If this is good or bad, honestly I do not know. It gives you great
flexibility and a BIG expressing power , but this has a double edge,
I'm afraid of seeing code that will be impossible to understand and
debugging/troubleshooting some other people code if they decide to be
"overcreative" with these features.
I think that's always the case when you reach a certain critical mass
of features: any random user will only use a subset of it and you can't
prevent duplicate ways of doing things anymore.
It's the duplicate ways of doing things which make things hard to
read. If there's a complicated way of doing a given thing A, but it's
the only way, no-one will bother. However as soon as there are two or
even more ways of doing the same thing A, or better: reaching the same
goal, you'll get groups of users who can't read / understand valid code
because they never use the way A is expressed in the given piece of
code.
It certainly will add complexity to the language and personally I'm
afraid that C# become the new C++ , superpowerful but with so many
features that only a few selected can masterize it. and this could
alienate the market.
That's already the case. Example: I personally never need to use
invoke directly in my code (only very very rarely) and almost never use
anonymous methods. However, there are people who use them regularly.
WHen I see their code, I have to look up the syntaxis sometimes to
understand what's going on, as I'm not familiar with it.
For example, can you write, without checking in the manual, a single
line piece of code which filters an List<T> on a given value for a
given property of T? I always have to lookup the anonymous method
syntaxis to write the predicate out, because I barely use it. The code
I then end up with looks odd to me, similar to these fancy typedefs in
the past which could emit cool code based on a single macro, like
typedef void (APIENTRY * PFNGLTBUFFERMASK3DFXPROC) (GLuint mask);
:P
For a seasoned C developer this is simple, but for a person who rarely
uses typedef, it's hard to read. Similar to anonymous filter methods.
Like sorting a list:
toReturn.Sort( delegate( TemplateBindings a, TemplateBindings b ) {
return -(a.PrecedenceLevel.CompareTo( b.PrecedenceLevel )); } );
fancy code, one line, but I personally hate this kind of code, because
it already is complicated to read. And this is C# 2.0. But as I said: I
find it hard(er) to read because I rarely use this syntaxis, but a
person who uses it a lot (because s/he likes it, dunno) it might be
simple and straight forward.
FB
--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
.
- Follow-Ups:
- Re: c# v3.0: implicit variable declaration, why?
- From: Jon Skeet [C# MVP]
- Re: c# v3.0: implicit variable declaration, why?
- From: Brian Gideon
- Re: c# v3.0: implicit variable declaration, why?
- From: Ignacio Machin \( .NET/ C# MVP \)
- Re: c# v3.0: implicit variable declaration, why?
- References:
- c# v3.0: implicit variable declaration, why?
- From: Nathan Laff
- Re: c# v3.0: implicit variable declaration, why?
- From: Ignacio Machin \( .NET/ C# MVP \)
- c# v3.0: implicit variable declaration, why?
- Prev by Date: Re: c# v3.0: implicit variable declaration, why?
- Next by Date: Re: /// <example>
- Previous by thread: Re: c# v3.0: implicit variable declaration, why?
- Next by thread: Re: c# v3.0: implicit variable declaration, why?
- Index(es):
Relevant Pages
|