Live data from Hacker News

More functional C#

news.ycombinator.com

31–40 of 98 posts

Re: More functional C#

#31
Absolutely - C# 3.5 introduced a beautiful suite of FP-ish features that made the language fun to write functional code with, and later versions of C# parallelized and asynced those FP-ish features.

Re: More functional C#

#32

This is a joke, right?

This is hobbyist code. It should never actually be used out in the real world. Once you make the distinction, you can better appreciate code snippets like these.

Ah, I'm all for that. The comments confused me to thinking it wasn't simply, look how you can do it in C# (but never actually dot his).

Re: More functional C#

#33
post #19

Earlier quoted context omitted.

Well, I use it =) C# is a language with a somewhat limited market ("Enterprise" applications running on Windows Servers, and yes, I know about Mono). And in this market, a very strict subset of C# (see: Java) is happily used. I know a lot of people who refrain from using even lambdas and implicit typing, let alone the other "fringe functional stuff", because "they make things complicated".

C# is a language with a somewhat limited market ("Enterprise" applications running on Windows Servers, and yes, I know about Mono) One would think that Windows Phone - fastest growing smartphone OS - would go before Mono... geez, I make a living out of desktop C# apps (WPF). Not solely, but on a daily basis.

Fastest growing is easier to achieve when you have low market share.

Mono is significantly more important for the future of C# than Windows Phone.

Re: More functional C#

#34
post #11

I have read a lot of lang. wars and complaints about programming languages... but C# is one of the only languages that I can't remember reading any complaints about. None. I must conclude, by the usual Stroustrup quote, that no one uses C#. (yes this is tongue in cheek)

You're not hanging around in the right circles then, I hear complaints about C# all the time ;). While there's plenty of limitations and frustrations you can run into with C#, I've generally felt they were largely due to intentional tradeoffs I can understand, and fail to know a better alternative to. This makes me significantly less ranty about it, in contrast to my other daily bread and butter of C++. Even if I fel…

Am currently reading "Thinking Fast and Slow" by Kahneman, this is a perfect example of a base-rate fallacy (something addressed in the book).

Absent any other evidence, one should assume the amount of complaining a language would get is about proportional to how widely it's used. So the lack of complaining (asserted by the parent) about C# might be as much a reflection on how widely it's used, than on the language itself.

Re: More functional C#

#35
post #8

C#'s functional side is why I actually really enjoy working with it. I get to use a nice blend of OO and functional, where each makes sense. OO more on a macro scale, organising code.

Scala has a lot of this, too. I've started using it because despite loving C#, the JVM is more widely supported on the PaaS providers (e.g. Heroku) than the CLR. You should check it out if you're ever in a position where JVM interop is a hard requirement.

Re: More functional C#

#36

This is a joke, right?

This is hobbyist code. It should never actually be used out in the real world. Once you make the distinction, you can better appreciate code snippets like these.

If you are going to criticize this approach to C# you are going to need to be more specific - the classic argument for this kind of thing is correctness, and against is optimization, is it the latter you are implicitly pointing out? And if so, what insight as to implementation details that you think make the solution slower?

Re: More functional C#

#37
post #11

I have read a lot of lang. wars and complaints about programming languages... but C# is one of the only languages that I can't remember reading any complaints about. None. I must conclude, by the usual Stroustrup quote, that no one uses C#. (yes this is tongue in cheek)

>C# is one of the only languages that I can't remember reading any complaints about

I've been using C# for about 3 years now. A year or two into using it I thought I was developing fanboy syndrome so I started a list of all of the dumb quirks and pitfalls the language has. Last time I checked, there were only 3 or 4 items on the list compared my python/c++/java lists which have 1-2 orders of magnitude more quirks.

C# really is a solid language, it's just a terrible shame it had to have the Microsoft label attached to it.

Re: More functional C#

#38
post #7

But why do things "near functional" when you have F# which is fully functional?

F# syntax is still a little confusing in the beginning, mostly because it does so much with so little syntax. And every time I'm using F# I seem to run into weird problems around indentation.

I like F# though. But I think it takes some getting used to, and I'm not quite there yet. :)

Re: More functional C#

#39
post #7

But why do things "near functional" when you have F# which is fully functional?

F# syntax is still a little confusing in the beginning, mostly because it does so much with so little syntax. And every time I'm using F# I seem to run into weird problems around indentation. I like F# though. But I think it takes some getting used to, and I'm not quite there yet. :)

Keep at it, though! F# does take a bit of getting used to if you're coming from C# or Java, but it doesn't take long -- maybe a week of writing it full-time, two at most -- before you're roughly as productive in F# as you are in other languages. From there, the sky's the limit :)
Post reply on HN