Live data from Hacker News

A whirlwind tour of object-oriented code in F# (2012)

fsharpforfunandprofit.com

121–130 of 130 posts

Re: A whirlwind tour of object-oriented code in F# (2012)

#121
post #15

I used to be a big Haskell programmer. While I still love the language, I've really come around to the idea that strictly evaluated functional languages like F# or OCaml are the best for programming in. You get the nice functional features but don't have the straightjacket of laziness forcing you into certain design decisions. It's really nice sometimes to be able to mix in impure, side effectful code without having…

It's easy to forgot the benefits of laziness: http://augustss.blogspot.com/2011/05/more-points-for-lazy-ev...

Laziness is a good default for declarative programming. Nix from NixOS is an example of a recent lazy language and benefits greatly from it.

Even in strict languages, lazy behaviour is often added, for example iterators and streams. Mixing effects and mutation with such constructs is also problematic.

Re: A whirlwind tour of object-oriented code in F# (2012)

#122
post #55

Earlier quoted context omitted.

> After a certain time, many C# developers find themselves writing in a functional style If you can't move to F# or find its tooling abysmal and slow then I have a library [1] that makes the inertia flow positively in the functional direction in C# https://github.com/louthy/language-ext/

Would love to use F# with Unity, but the typical high allocation rates that come with the functional language territory scare me. Looked at your library, it's very interesting. I saw your docs note about the allocation efficiency of Map, would like to hear more. Could you characterize the library's general allocation story?

I've done a short write-up about this:

https://github.com/louthy/language-ext/wiki/Performance

Re: A whirlwind tour of object-oriented code in F# (2012)

#123
post #104

Earlier quoted context omitted.

What would you choose instead if you needed to write a simple web server?

Simple web servers are already written for me. If I'm serving static files, I'll just use a CLI tool or S3. If I'm making a simple API, I've already moved into territory where I'd prefer to use C# or something like that. The ecosystem is better and you can write it to avoid runtime gotchas. Big languages/stacks can still write tiny programs.

Considering we're in an F# thread, it makes sense that both alternatives to Node.js mentioned were part of the Microsoft stack (C# and F#). This furthers my conclusion that people just prefer the tools they're already familiar with, for better or worse.

Re: A whirlwind tour of object-oriented code in F# (2012)

#124
post #24

It's a pity the tooling is comparatively immature, with F# (or at least that was my experience last time I tried to develop with it). I think Rider is getting there, though. To go into more detail, the initial implementation in Rider was limited to not much more than syntax highlighting. Inspections were fairly limited, ASP.NET MVC integration was not as featureful. On the C# side, it's much more developed and refine…

I've been developing F# in Rider for the last 4 weeks, and especially the last update made a huge step forward. It's stable, fast, the test-runner works perfectly, etc. It's definitely not at the same level as the C# tooling yet, but it's good enough to be productive. (I'm on macOS by the way, building Xamarin apps).

Glad to hear it's improved!

Re: A whirlwind tour of object-oriented code in F# (2012)

#125
post #122

Earlier quoted context omitted.

Would love to use F# with Unity, but the typical high allocation rates that come with the functional language territory scare me. Looked at your library, it's very interesting. I saw your docs note about the allocation efficiency of Map, would like to hear more. Could you characterize the library's general allocation story?

I've done a short write-up about this: https://github.com/louthy/language-ext/wiki/Performance

Terrific info, thanks! Looking forward to using it.

Re: A whirlwind tour of object-oriented code in F# (2012)

#126
post #104

Earlier quoted context omitted.

Simple web servers are already written for me. If I'm serving static files, I'll just use a CLI tool or S3. If I'm making a simple API, I've already moved into territory where I'd prefer to use C# or something like that. The ecosystem is better and you can write it to avoid runtime gotchas. Big languages/stacks can still write tiny programs.

Considering we're in an F# thread, it makes sense that both alternatives to Node.js mentioned were part of the Microsoft stack (C# and F#). This furthers my conclusion that people just prefer the tools they're already familiar with, for better or worse.

I'm much more familiar with Node and PHP than .NET. I've only been able to use .NET on one project professionally, and while the language (C#) is missing some of the type safety I enjoy, it's much more solid. I almost never had runtime errors or found immature libraries.

Don't assume everyone is a fanboy/fangirl just because they have a recommendation.

Re: A whirlwind tour of object-oriented code in F# (2012)

#127
post #104

Earlier quoted context omitted.

Simple web servers are already written for me. If I'm serving static files, I'll just use a CLI tool or S3. If I'm making a simple API, I've already moved into territory where I'd prefer to use C# or something like that. The ecosystem is better and you can write it to avoid runtime gotchas. Big languages/stacks can still write tiny programs.

Considering we're in an F# thread, it makes sense that both alternatives to Node.js mentioned were part of the Microsoft stack (C# and F#). This furthers my conclusion that people just prefer the tools they're already familiar with, for better or worse.

Before making that conclusion, try asking some people who are comfortable with a handful of languages which they would use and why.

Re: A whirlwind tour of object-oriented code in F# (2012)

#128

Earlier quoted context omitted.

The first stepping stone the front-end folks take into server side programming. :D

What would you choose instead if you needed to write a simple web server?

Probably Kotlin, maybe Go or Python.

Re: A whirlwind tour of object-oriented code in F# (2012)

#129
post #26

For all the love Microsoft has been getting these days, I still don’t get how I’m supposed to write C# or F# without Visual Studio and Windows. Am I missing something? VSCode doesn’t support these languages, right? I’m a person who spent a long time trying to write Java in Vim, but switched to IntelliJ and wouldn’t want to write C#/F# without some comparable IDE.

You can use Rider which is a very good crossplatform JetBrains IDE. I found it very fast too (I use it on Fedora in my laptop)

I recently switched to Rider after finally giving up on the performance issues in Visual Studio - VS is a fantastic IDE, but I'm sick of the perf issues and having my laptop permanently sounding like it's going to take off...

After setting up the theme and font and such... I love Rider! It's extremely customisable, and actually has some features than VS doesn't. And of course it's backed by ReSharper too. Highly recommended it!

Re: A whirlwind tour of object-oriented code in F# (2012)

#130

> Anything C# can do... Yes, yes, you can do anything in F#, but what should you do? My opinion is that that what F# is missing is a good set of idioms and a strongly opinionated set of guidelines. To my beginner's eyes, every F# codebase I've seen feels like it's written in a completely different language; it's like the opposite of Python's "one right way to do everything". I've heard that F# is great for domain-spe…

As a long time C# dev who has dabbled with F#, I kind of feel the same.

I always find myself structuring appa like an OO app, which invariably results in something that feels wrong.

For someone for which OO is so entrenched, it's really difficult to think differently - and there doesn't seem to be an idiomatic way to write F# code (not that I've found, anyway); every code base seems to take a different approach.

Post reply on HN