News for hackers. Stuff that matters.
Re:Get Ready For C# 4.0 by bfung on Monday May 10, 2010 @12:52PM (#1335050)
The funny thing I come back to question myself with after seeing ExpandoObject and not needing to declare types (var blah = ), is, why not just go all the way to Ruby instead of being stuck inbetween?
Re:Get Ready For C# 4.0 by mquander on Monday May 10, 2010 @01:09PM (#1335157)
Well, I'm not sure that's fair. In most dynamic languages, you can add type annotations and/or formal pre/post-conditions to selected pieces of code, usually for either compiler verification or optimization purposes; thus making a little piece of your code statically typed. Would you say they should just "go all the way to C#" (or ML, or whatever you prefer?) Of course not.

The C# situation with dynamic is analogous. It's for people who like working in a static language, but want a particular piece of code dynamically typed because it happens to be very convenient for the task at hand. Obviously, there are a fair number of such tasks; mostly whenever you're dealing with a piece of structured but unpredictable data that lives outside your static bubble, like XML or external unmanaged libraries.

And var isn't really worth mentioning; it's just very simplistic type inference on declarations. It's just (very good) syntax sugar and doesn't have any special semantic meaning at all.

Re:Get Ready For C# 4.0 by bfung on Monday May 10, 2010 @02:25PM (#1335468)
The part I fear most is that every object suddenly becoming an ExpandoObject; there will be someone 'clever' that will do that. I'm speculating, but when you have a hammer...

I think this also has to do with language expectations, express-tivity, and maintainability. A project already using a dynamic language will have some sort method to deal with the nature that certain calls will or will not exist. The addition annotations/conditions seem like optimizations, but doesn't fundamentally change how a programmer would go about using that dynamic language. C#, on the other hand, the language is more constrained to begin with. A (C#) programmer would normally expect certain things such as an interface having a certain number of methods with certain types. Just imagine a library exposing an api with expandos... =p

Re:Get Ready For C# 4.0 by mquander on Monday May 10, 2010 @02:34PM (#1335499)
I agree, and so does Microsoft, actually; I had the chance to ask a fellow on the C# team (I don't work for MS but I was there recently) why some things in the BCL weren't made dynamic -- for example, when you call a constructor via reflection, and it passes you an object whose type is indeterminate at compile-time, why doesn't it now return type dynamic instead of type object?

His answer was basically your concern, that they didn't want to get in the habit of exposing dynamic things all over the place, since they felt it was sort of an unexpected thing to be doing in a language like C#. Hopefully third-party library programmers will be equally judicious.

Re:Get Ready For C# 4.0 by cema on Monday May 10, 2010 @01:02PM (#1335122)
As they used to say, why not just go all the way to Lisp instead of etc?

Just so as not to scare people off.

Re:Get Ready For C# 4.0 by rbanffy on Monday May 10, 2010 @01:06PM (#1335147)
Or Python, or Lisp...

The use of .NET and C# (and Java) is often mandated by management levels, specially in large companies. For those unlucky folks, even a tiny little progress is a move in the right direction.

Even if you want a .NET-like environment, you could use JRuby, Jython or Clojure and have a far better programming experience on top of the JVM.

I really see no reason to even consider C# or .NET.

Re:Get Ready For C# 4.0 by jacquesm on Monday May 10, 2010 @01:27PM (#1335224)
Man the moderation in this thread is biased.

Would whoever modded this down please explain how this is worth modding down instead of writing why you disagree with it?

Re:Get Ready For C# 4.0 by mquander on Monday May 10, 2010 @01:34PM (#1335254)
I didn't mod it down, but it seems intentionally shortsighted. I use both C# (for work) and Clojure (for fun) regularly; I'm a big Lisp weenie, and even I don't feel like I'm having a "far better" programming experience with Clojure than with C#. The language is somewhat better, but the tooling is somewhat worse, in my opinion.

Saying those things are "far better" is just flamebait. If you're going to write such criticism, it's up to you to justify your statements, not up to other people to defend against a non-existent argument.

EDIT: Stop modding me up, holy shit. This is off-topic and it's not important. Why do you want to highlight this self-evident comment so much that you're giving it a bunch of points? If I could have just messaged jacques instead of posting, I would have done that.

Re:Get Ready For C# 4.0 by zephyrfalcon on Monday May 10, 2010 @04:40PM (#1335871)
"I don't feel like I'm having a "far better" programming experience with Clojure than with C#. The language is somewhat better, but the tooling is somewhat worse, in my opinion."

That does make sense. When it comes to things like, say, desktop application development, Clojure probably isn't there yet, even though it's backed by all the Java libraries. C# and .NET, on the other hand, were designed with this purpose in mind (among other things). If I had to write a Windows desktop app, I probably would choose C# over Clojure any day, even though I like Clojure better as a language. But, as they say, programming languages don't operate in a vacuum...

Re:Get Ready For C# 4.0 by jacquesm on Monday May 10, 2010 @01:36PM (#1335266)
Which is great, because you actually provide some arguments. Downmodding like that to me is like trying to muzzle someone, as though by downvoting you can somehow prove they're wrong, whereas you can only really show someone is wrong by bringing a counter argument, preferably a solid one.
Re:Get Ready For C# 4.0 by mquander on Monday May 10, 2010 @01:40PM (#1335283)
To encourage counter-arguments, one ought to make the original argument concrete and objective. Making a post to argue against a paragraph of snubs and the unsupported statement that X is just a "far better programming experience" than Y feels to me like getting trolled, not like having an argument.
Re:Get Ready For C# 4.0 by jacquesm on Monday May 10, 2010 @02:00PM (#1335365)
Yes, but your own counter argument is based on a feeling, that's not much more solid than what Ricardo said to begin with, it is also unsupported, or at best anecdotal.

None of this based on objective facts or stuff that you could measure. His truth to me is as good as your truth.

But he got modded in to the ground and you got modded up.

Re:Get Ready For C# 4.0 by mquander on Monday May 10, 2010 @02:13PM (#1335423)
I know. I didn't intend mine as a counter-argument, but just as background for why I felt it was flamebait -- I have experience that indicates to me it's not credible to just uncategorically state that one is "far better." Like I expressed, it doesn't seem like there was much of an argument to make a counter-argument to.

I wouldn't have modded me up, either; in fact, I would have modded me down, because this whole discussion is off-topic and doesn't deserve attention. I think the majority of moderation on here seems awful and is rarely even vaguely proportional to the quality of the comments, and I agree that this is an example of awful moderation. So you're arguing with the wrong fellow.

EDIT: I amended my comment above to be irritating and sarcastic toward people who modded me up.

Re:Get Ready For C# 4.0 by jacquesm on Monday May 10, 2010 @03:51PM (#1335720)
> EDIT: I amended my comment above to be irritating and sarcastic toward people who modded me up.

Classy! My email is in my profile by the way, in case you ever want to take something 'offline'.

Re:Get Ready For C# 4.0 by SamReidHughes on Monday May 10, 2010 @02:47PM (#1335541)
His comment was idiotic and he's sounding like a smug dynamic language weenie. It pulls the "mandated by management" straw man, groups C# and Java together and treats them the same (which is strong evidence that the parent doesn't have a clue about what he's talking about) and did I mention it's got that classic dynamic language weenie smell?

The image that got conjured in my mind when reading that post was one of a teenage girl on the phone going, "C#? What. everrrr."

"I really see no reason to even consider C# or .NET."

This looks like an exhibition of the classic blub fallacy.

Re:Get Ready For C# 4.0 by rbanffy on Monday May 10, 2010 @06:25PM (#1336139)
So, let's try to make your post into something more informative.

> he's sounding like a smug dynamic language weenie

I'll give you that. I have a strong opinion on the overall usability of statically-typed languages. I have been writing Java code for the past month and I really feel less productive than the month before, despite the very smart tools that take away most of the drudgery. I am also not anti-static-typing: I like C a lot. I don't like C++ that much because of Smalltalk-induced bias.

> It pulls the "mandated by management" straw man

I am yet to witness a C# project that's not born out of a corporate IT department. I have never seen someone move from dynamic languages to static ones for other reason than execution speed, and, even then, only after careful profiling.

> This looks like an exhibition of the classic blub fallacy.

Name 5 reasons to consider C# as your development language and I'll concede you another point. While you are at it, name 1 area where C# is considered the best language.

Re:Get Ready For C# 4.0 by SamReidHughes on Monday May 10, 2010 @07:42PM (#1336273)
> So, let's try to make your post into something more informative.

No, let's not. How about you keep your condescending attitude offline.

Re:Get Ready For C# 4.0 by zephyrfalcon on Monday May 10, 2010 @04:37PM (#1335855)
That would make sense, if C# was more powerful/expressive than Python, Lisp or the like. It's not; it's just the least sucky (language-wise) of the mainstream statically typed languages. Plus it has all the .NET libraries and works well on Windows (naturally), which are reasons why people choose (or are forced) to use it. Not because it's the epitome of power and flexibility...
Re:Get Ready For C# 4.0 by SamReidHughes on Monday May 10, 2010 @07:46PM (#1336287)
> That would make sense, if C# was more powerful/expressive than Python, Lisp or the like.

What? My comment makes sense, even if C# is worse than Python, etc.

Re:Get Ready For C# 4.0 by zephyrfalcon on Monday May 10, 2010 @11:58PM (#1336836)
To quote the relevant parts from [http://www.paulgraham.com/avg.html]:

"As long as our hypothetical Blub programmer is looking down the power continuum, he knows he's looking down. Languages less powerful than Blub are obviously less powerful, because they're missing some feature he's used to. But when our hypothetical Blub programmer looks in the other direction, up the power continuum, he doesn't realize he's looking up. What he sees are merely weird languages. He probably considers them about equivalent in power to Blub, but with all this other hairy stuff thrown in as well. Blub is good enough for him, because he thinks in Blub."

The "paradox" (or "fallacy", as you called it) here refers to looking at a language that is more powerful, but not realizing that it is. By contrast, when looking at a language that is less powerful, this is usually obvious.

Re:Get Ready For C# 4.0 by SamReidHughes on Tuesday May 11, 2010 @01:18AM (#1336980)
My interpretation of the definition is that it's about being unable to recognize the benefits of something you're unfamiliar with.

> By contrast, when looking at a language that is less powerful, this is usually obvious.

You mean like how when I look at Python, its deficiencies relative to C# are obvious? Or are you talking about how when you look at C#, its deficiencies relative to Python are obvious? The blub paradox goes both ways.

Re:Get Ready For C# 4.0 by j_baker on Monday May 10, 2010 @01:48PM (#1335315)
The main reason is that it makes it much, much easier to interface C# with languages like IronPython or IronRuby. This allows you to take advantage of those languages' dynamic typing, but not have to drop into C when you need to squeeze a bit more performance out of your code.
Re:Get Ready For C# 4.0 by sid0 on Monday May 10, 2010 @01:09PM (#1335160)
Because static typing is really, really useful?
Re:Get Ready For C# 4.0 by bfung on Monday May 10, 2010 @01:53PM (#1335330)
ExpandoObject basically says you can add properties ad hoc. When that happens, how do I know when a property on the object exists or not? The value of static typing goes down with ad hoc properties.
Re:Get Ready For C# 4.0 by mquander on Monday May 10, 2010 @02:23PM (#1335459)
Sure; if every object was an ExpandoObject, the value of your "static typing" would be nil. The point is that you can just make an ExpandoObject if you really need ad hoc properties in one place, and it cooperates with the rest of your statically-typed code.

To illustrate the value of such a thing, I invite you to look at the ADO.NET libraries for data access, which provided a verbose, painful "dynamic property bag" experience as far back as .NET 1.0; you had DataTables with columns that you would pass a type to, and then you had DataRows that you indexed into with strings to put objects in and get them out, and you had to cast them back and forth as you did it -- all of it ugly, none of it checked at compile-time. The value of C# dynamic (besides interop) is that now you can have such a thing in a fairly concise form with syntax that doesn't make you sob uncontrollably when you use it.

Re:Get Ready For C# 4.0 by TeHCrAzY on Monday May 10, 2010 @07:44PM (#1336280)
And people do use it. I have worked on a mind bending .NET call centre application within which the entire state of the program is stored within untyped, globally accessible datatables.

It's down to the old "with great power comes great responsibility" idea.

Re:Get Ready For C# 4.0 by frou_dh on Monday May 10, 2010 @02:23PM (#1335460)
This ruby comparison might make sense if people were to use C#'s dynamic all over the place, but it's just a single feature intended for specific situations. Most of the code will remain as sensibly static as ever.
Re:Get Ready For C# 4.0 by zephyrfalcon on Monday May 10, 2010 @04:29PM (#1335832)
If done properly, yes... [looks at Haskell and OCaml]