Live data from Hacker News

Learning Haskell/Python makes you a worse C# programmer

lukeplant.me.uk

1–10 of 64 posts

Re: Learning Haskell/Python makes you a worse C# programmer

#2
> The fact is that functional idioms work badly in languages that don't have syntactic support for them.

You can even remove functional from the sentence. Powerful features of languages like Python and Lisp don't get you more power than languages like Java. They give you more power per unit of effort.

Re: Learning Haskell/Python makes you a worse C# programmer

#6
It is unfortunate, that the type of positions that employ .NET developers, enforce C# (or sometimes VB.NET) as their language that targets the CLI. While I understand the need for consistency, it would be nice if IronPython or F# were accepted. But dont just feel defeated, make a case to your architect or manager, they might be open to it. However its worth noting that in my experience, C# is a fine language - especially if you can move past .NET 2.0 and use lambdas and LINQ.

Re: Learning Haskell/Python makes you a worse C# programmer

#7
I think the author is simply inexperienced in C#. Here's the right way to express his code:

    string.Join("\n",
        from elem in myList
        where elem.Description != ""
        select elem.Description);
Note how mind-numbingly close this is to the Python:

   "\n".join(foo.description() for foo in mylist
                         if foo.description() != "")
I also think it's considerably easier to read than the foreach loop.

Re: Learning Haskell/Python makes you a worse C# programmer

#8

It is unfortunate, that the type of positions that employ .NET developers, enforce C# (or sometimes VB.NET) as their language that targets the CLI. While I understand the need for consistency, it would be nice if IronPython or F# were accepted. But dont just feel defeated, make a case to your architect or manager, they might be open to it. However its worth noting that in my experience, C# is a fine language - especi…

I think part of the problem is that, while the CLR is vastly better than the JVM at supporting languages other than its flagship, I also think that the cost of using languages other than C# or VB.NET is higher than a lot of developers are willing to admit.

We just allowed some F# code into Kiln. On the one hand, it was vastly simpler than the C# code it replaced. On the other hand, we had to rearchitect our solution layout to handle changing the build order, which we in turn had to do so that the F# code could be sanely usable from the C# code and vice-versa, which in turn required writing a lot of call-site boilerplate and type converters (from C# to F# types). Add in that the CLR is simply not as optimized for F# as for C# (or vice-versa, depending on how you want to view things), and it's not exactly a situation where you can simply say, "Well, F# is better than C# at expressing this problem, so let's use it here."

I want to be really clear on this: I don't think these problems are any worse on the CLR than they'd be on the JVM or with native tools (e.g., OCaml calling C or vice-versa). In fact, they're better in many ways: you have the BCL for your primitives, rather than the native C ABI (for native), and you have a VM that is legitimately much less tied to an individual language than the JVM, which makes things like tail-recursive languages a lot simpler. But I think the right way to regard Foo# languages is more-or-less the same as any other language: unless you can write the entire project in Foo#, think hard about whether the cost of interfacing between Foo# and C# is worth it to your project. Most of the time, it isn't.

Re: Learning Haskell/Python makes you a worse C# programmer

#9
well i completely disagree. he's got a point in his first paragraph, maybe a little different though. If all you saw is C# code from C# people you won't care one bit about the disgusting mess they create.

But if you've learned a whole range of languages you'll try to come up with more elegant solution. He tried that, but as gecko pointed out the errors were not in trying, but rather in his results.

I work in a C# dev house now, and boy what is considered a good solution there (and in their contractors works) is so sad I don't even know what to call it.

But then, you look at the latest c# version and it has quite a few interesting features, people just don't use it. My guess is that they've just been doing it since c# 2.0. And the fact that c# is not really made for web development, which is what it seems to be most taught doesn't really help either.

Re: Learning Haskell/Python makes you a worse C# programmer

#10
post #3

Or in perl: join "\n", map { $_->{description} } grep { $_->{description} ne "" } @mylist; sorry, every time i see something like this, i just can't resist to post code in Perl. =)

I'll see your Perl5 and raise you some Perl6:

    @list.map(*.description).grep(?*).join("\n")
Post reply on HN