Live data from Hacker News

6 Months with C#

ruoyusun.com

71–80 of 84 posts

Re: 6 Months with C#

#71

Earlier quoted context omitted.

I'm a huge fan of Miguel and the rest of the Xamarin crew, and I'd love to see a universal implementation of the CLR take dominance. I think maybe 5 years ago the CLR had a real chance to win in the battle of multi-language runtimes, but at this point I think the war is going to the JVM. (Chalk that up to yet another short-sighted decision by Microsoft.) The problem is that Java (the language) completely dominates th…

> F# actually have significant percentages of uptake because they're actually supported by Microsoft. Scala, Clojure, etc.... are just miniscule blips on the radar in comparison. I think that's pretty much wrong. Despite Microsoft shipping F# support in their main IDE, pretty much no one uses it. Can you name one popular library which switched from C# to F#? Compare that to e. g. Scala: Huge amount of adoption compar…

Despite Microsoft shipping F# support in their main IDE, pretty much no one uses it

Actually, it's fairly popular in the analytics-type world.

Can you name one popular library which switched from C# to F#?

That doesn't even makes sense.

Compare that to e. g. Scala: Huge amount of adoption compared to F#, despite _not_ shipping with any IDE by default. One of the most popular Java web frameworks switched from Java to Scala recently.

There hasn't been huge amounts of adoption...not even close. You're confusing blogosphere hype to real numbers.

Even the F# “elite” is aware of it and complaining about how Scala has a a lot higher adoption (and a larger ecosystem and more developers, libraries, conferences, user groups, support, ...), so I'm a bit surprised by your statement.

Now you're just making things up.

Re: 6 Months with C#

#72

Earlier quoted context omitted.

> F# actually have significant percentages of uptake because they're actually supported by Microsoft. Scala, Clojure, etc.... are just miniscule blips on the radar in comparison. I think that's pretty much wrong. Despite Microsoft shipping F# support in their main IDE, pretty much no one uses it. Can you name one popular library which switched from C# to F#? Compare that to e. g. Scala: Huge amount of adoption compar…

Despite Microsoft shipping F# support in their main IDE, pretty much no one uses it Actually, it's fairly popular in the analytics-type world. Can you name one popular library which switched from C# to F#? That doesn't even makes sense. Compare that to e. g. Scala: Huge amount of adoption compared to F#, despite _not_ shipping with any IDE by default. One of the most popular Java web frameworks switched from Java to…

> Now you're just making things up.

http://skillsmatter.com/podcast/home/expert-panel-discussion...

Re: 6 Months with C#

#73
post #66

Earlier quoted context omitted.

That's not equivalent code, it doesn't execute itself. That it simply returns a string with no logic and therefore can be written slightly simpler belays the point I was making. You simply don't see this type of code being used much in C# because it isn't idiomatic, yet it exists to mark off a checkbox.

Fair enough, if you want to automatically execute an anonymous function, your example isn't idiomatic C# either. The idiomatic version would look like this: var func = () => "foo"; func(); As far as "you don't see this type of code being used much", that's just patently false. Anonymous functions (particularly predicates) are the whole way you interact with LINQ. So I'll ask this: what's the equivalent example in Jav…

Your example won't even compile. You're confusing functions with lambda expressions. Lambda expressions look a little like a function but they are something different. Lambda can be compiled into functions at run time and that's often what they're used for, but they can't be implicitly assigned to a var. Doing it you're way would look like this:

    Expression> func = () => "foo";
    func.Compile()();
    
That's hardly better, and it's still not anonymous! You probably like Lambda Expressions because they make things like LINQ elegant, and indeed they do. But a lambda expression is confusingly similar looking to a func (indeed a mistake you made) but when you try to do something more complicated like this:

    Expression> func = () =>
    {
      string foo = "bar";
      return foo;
    };
    
That won't compile because a lambda expression can't have a statement body, it can only contain (a single!) expression.

Now the cool thing about lambda expressions is that to the end user they are simple and elegant assuming you know that they are not the same thing as functions, but on the other end of it; consuming a lambda expression you get to see the guts of it and realize what a hack it is on the language. Sure, in the context of a compiled statically typed language it's rather powerful. It's how they are able to compile a lambda expression into a SQL statement, because you can inspect lambda expressions which you can't do to functions.

Now you asked about Java and I'm not going to defend Java or predict what their intentions are, but I'll just say that Java is being much more conservation about sticking to what it is; a statically typed compiled language. C# is attemping to be everything to every body.

Re: 6 Months with C#

#74
post #41

Earlier quoted context omitted.

I agree with what you're saying, but without a proper implementation outside of Windows, the CLR is currently a place where great languages go to die. Mono is functional, but is basically unsupported (for everything but mobile).

the CLR is currently a place where great languages go to die No, F# is completely supported by MS. And that's the problem with the alternative languages on the JVM. Decision makers are wary of anything that isn't officially supported by Oracle. There are other problems with languages like Scala and Clojure that have nothing to do with official support, but that's another story. The mono story is an interesting one. A…

"What's funny is the JVM is completely irrelevant on mobile compare to .NET/Mono"

I think you meant "on iOS", not "on mobile". Android has a huge share of the mobile market. And Android is pretty much Java (but maybe you don't consider the Dalvik VM to be a JVM running Java programs).

Also you make it sound like somehow .Net/Mono would be huge on iOS. Just to set things straight: most development on iOS is done in Objective-C.

Re: 6 Months with C#

#75
post #11
post #8

I don't understand why everyone on HN hates Windows server so much. From an administration standpoint they are much easier to setup and use thanks to their GUIs. Windows is very standardized and has very good management tools and interfaces. C#, ASP MVC, and Visual Studio are extremely good tools. I've programmed in C# for 10 years and never had a project I could not do quickly with it. It has very good support of 3r…

I've done both (win and linux) and they each have their disadvantages and advantages, it would be hard for me to pick a clear winner because it really depends on your skillset and the task at hand. If i were to do a big enterprisey project with a big budget i would definitely be more likely to go with windows while if i were to do a web/online start-up i would more likely pick Linux.

Medium enterprisey project with a medium budget, I see people picking C#/CLR>

But really big enterprisey stuff with really big budget? It's all Oracle DB + Java on Unix there.

Just as all the really big infrastructures (Google, FedEx, Amazon, etc.) are all Unix.

Re: 6 Months with C#

#76
post #66

Earlier quoted context omitted.

Fair enough, if you want to automatically execute an anonymous function, your example isn't idiomatic C# either. The idiomatic version would look like this: var func = () => "foo"; func(); As far as "you don't see this type of code being used much", that's just patently false. Anonymous functions (particularly predicates) are the whole way you interact with LINQ. So I'll ask this: what's the equivalent example in Jav…

Your example won't even compile. You're confusing functions with lambda expressions. Lambda expressions look a little like a function but they are something different. Lambda can be compiled into functions at run time and that's often what they're used for, but they can't be implicitly assigned to a var. Doing it you're way would look like this: Expression > func = () => "foo"; func.Compile()(); That's hardly better,…

This compiles:

  Func func = () => "foo";
  string result = func();

Re: 6 Months with C#

#77
post #59
post #51

Earlier quoted context omitted.

And will only become a problem when you reach a huge scale. If by that time it is still a problem then maybe your problem is not having a good enough business model.

We're seed-funded and have somewhere around 70 instances in AWS, almost all Linux. In our business, our margin depends largely on our operational costs, and using Windows would be a significant hit to our bottom line.

So if you had to double your servers (say to 140) would you be at loss?

I hope that this is just the initial phase of the company (although not too initial since you need 70 instances) and that you will get to a better margin along the way. Otherwise ANY bump you hit road ahead will break you.

Competing on a market that relies entirely on price is a death sentence, unless of course this is your plan.

Re: 6 Months with C#

#78
post #66

Earlier quoted context omitted.

Fair enough, if you want to automatically execute an anonymous function, your example isn't idiomatic C# either. The idiomatic version would look like this: var func = () => "foo"; func(); As far as "you don't see this type of code being used much", that's just patently false. Anonymous functions (particularly predicates) are the whole way you interact with LINQ. So I'll ask this: what's the equivalent example in Jav…

Your example won't even compile. You're confusing functions with lambda expressions. Lambda expressions look a little like a function but they are something different. Lambda can be compiled into functions at run time and that's often what they're used for, but they can't be implicitly assigned to a var. Doing it you're way would look like this: Expression > func = () => "foo"; func.Compile()(); That's hardly better,…

You're right, I'm a bit rusty, not having written anything large in C# for a couple of years. The compiler can't infer the type, so it would be:

    Func foo = () => "foo";
    func()
I'm well aware of the difference between an anonymous function and an expression in C#. What in your example suggests that you should be using an expression? In practice, you never need to work with expression trees unless you're doing metaprogramming of some kind. They were added to the framework primarily to support metaprogramming and support the DLR.

LINQ (or at least "LINQ to Objects") does not use expression trees. For example, this is the signature of the Select() extension method:

    public static IEnumerable Select (this IEnumerable source, Func selector) { ... }
    
Note the lack of Expression>.

Things like LINQ to SQL and the Entity Framework translate these statements into expression trees, but they do it transparently inside the framework.

My point in bringing up Java is that in order to do something like what we're talking about, you'd have to jump through a whole bunch of hoops. It certainly would be more difficult than in C# -- which is really what matters more than the "purity" of the language.

Re: 6 Months with C#

#79

Microsoft is trying too hard to make C# answer to every single technology trend, adding dynamic type, asynchronous methods, etc. In most cases you wind up with a working but much worse alternative to the real thing. For example, here's how you create an anonymous function that returns a string in C#: (new Func (() => { return "foo"; }))(); That's pretty awful and as a result you rarely see anyone doing stuff like tha…

    new Func(()=>"foo")();

    (function(){return "foo";})();
Oh look - exactly the same number of characters. How awful.

Re: 6 Months with C#

#80
post #66

Earlier quoted context omitted.

Fair enough, if you want to automatically execute an anonymous function, your example isn't idiomatic C# either. The idiomatic version would look like this: var func = () => "foo"; func(); As far as "you don't see this type of code being used much", that's just patently false. Anonymous functions (particularly predicates) are the whole way you interact with LINQ. So I'll ask this: what's the equivalent example in Jav…

Your example won't even compile. You're confusing functions with lambda expressions. Lambda expressions look a little like a function but they are something different. Lambda can be compiled into functions at run time and that's often what they're used for, but they can't be implicitly assigned to a var. Doing it you're way would look like this: Expression > func = () => "foo"; func.Compile()(); That's hardly better,…

You're wrong. A lambda can have a body. Compiles and executes:

  new Func(() => {
    var foo = "bar";
    return foo;
  })();
Post reply on HN