Re: c# v3.0: implicit variable declaration, why?

Tech-Archive recommends: Speed Up your PC by fixing your registry



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#)
------------------------------------------------------------------------
.



Relevant Pages

  • Re: office 2003 most menu items are grayed out
    ... Milly Staples [MVP - Outlook] ... | "few features" mode (can't remember the real word for it right now!) ...
    (microsoft.public.office.misc)
  • Re: Open and Repair
    ... 2003), etc. (If you're using Vista, look for Programs and Features in Control Panel.) ... Herb Tyson MS MVP ... Blog: http://word2007bible.herbtyson.com ...
    (microsoft.public.word.application.errors)
  • Re: Whats wrong with VS.NET/2005
    ... The major problem, which MS will never be able to fix, is lumping everything into one big program. ... but instead of improving it they replaced it. ... Now you are forced to by a program which contains features you don't want. ... MVP Tips: http://www.flounder.com/mvp_tips.htm ...
    (microsoft.public.vc.mfc)
  • Re: Labels - Word vs WordPerfect
    ... Having said that, I did get used to Wordpro context sensitive popup boxes, ... way to add in features that would not incite lawsuits.. ... For labels, I use Avery DesignPro.. ... MVP - Windows Shell/User ...
    (microsoft.public.word.newusers)