
Introducing F# 4.0 - adad95
http://www.infoq.com/news/2015/04/FSharp-4
======
s_kilk
Can any F# users point me towards a guide on getting started with F# and Mono
on OS X? Just enough to get a simple build chain set up and get started
learning the language.

~~~
majecty
I wrote a blog post about setting simple fsharp project without monodevelop.
You need to install fsharp using brew before read the post.

[https://majecty.wordpress.com/2015/04/19/making-fsharp-
proje...](https://majecty.wordpress.com/2015/04/19/making-fsharp-project-
using-command-line/)

~~~
s_kilk
Thanks, this was really helpful!

------
marpstar
I've been writing most of my utility code in F# for the past few months, is
there anything that you guys DON'T like about it? I'm really enjoying how
terse it is in comparison to C# and haven't really run into anything that's
bothered me, besides Xamarin Studio being bloated.

~~~
mistermann
Could you post any comparison code demonstrating the terseness, or suggest a
good site that might demonstrate this?

~~~
marpstar
[http://fsharpforfunandprofit.com/posts/classes/](http://fsharpforfunandprofit.com/posts/classes/)
starts off with a C# vs. F# class declaration example. Particularly when you
want to create a class with 3 member properties and a constructor accepting
those 3 properties as parameters, you can achieve that in 4 lines of F# vs. 8
(non-curly brace) lines of C#.

This sort of conciseness is found all over the language as you keep digging
deeper. I really recommend Scott Wlaschin's (link author) entire site. The
best online resource for learning F#, IMO.

~~~
Guillaume86
Just to nit-pick: C# 6 should bring this particular case on par with F# if I
remember well.

------
azurelogic
I was just discussing F# with my coworkers today. I feel like it doesn't get
much attention because neither the OO or the FP camps want to own it. It's too
different for OO people, and FP people won't find it pure enough. Is that
correct, or are my observations and inferences way off?

~~~
MichaelGG
The lack of attention is that Microsoft doesn't want to put too much cash into
it, and hasn't figured out the marketing message. Microsoft has sold the
message that F#'s for strange high-IQ people in finance or science and so on.
A lot of ".NET developers" are just confused. I mean, ffs, look at C#'s "var"
keyword. Even some highly respected people that worked at Microsoft didn't
understand it and called it "dynamic typing". If high-up "engineers" can't
understand these basics, then what chance do the majority of MS's customer
base? Doesn't look good.

Plus the hiring mentality is "oh no, we won't find an _F#_ developer". The
problem is that they're looking for "language" developers in the first place.
Who the hell cares if a hire knows F#? If they don't but worth hiring, they'll
easily learn it. This is true for most languages, but extra true for F# as you
still have the CLR, the whole .NET Framework, Visual Studio, etc.

The biggest thing holding F# back apart from that, and apart from people that
are well, scared of it, to put it kindly, has been .NET itself. Mono's been
flaky for F# development I hear, and people have been suspicious of .NET
overall, I feel. Though I do have long-running server apps at high volume
working fine with F# on Mono on Linux, ASP.NET and other experiences are
suboptimal.

With Microsoft's new stance on open source and shipping .NET everywhere,
hopefully a lot more people will give it a spin. F#'s probably in the top spot
for the combination of tooling, libraries, and language - so long as you don't
mind GC.

As far as the language itself, it does a pretty good job at doing multi-
paradigm. In fact, it does OO better than C# in some cases (object
expressions).

------
MichaelGG
While these are nice... Are there no headline features? Macros or something?

~~~
m0th87
The whole article is about features added. The first point is even about
improvements to macros.

~~~
chadzawistowski
Unfortunately F# doesn't really have macro support... "working with expression
trees is becoming easier than ever" but you can't actually unquote/eval an
arbitrary expression tree.

The only purpose I can see for expression trees is implementing a DSL with F#
syntax.

~~~
VoiceOfWisdom
Its not possible out of the box, but there are several community libraries to
eval quotations[0].

Shame on whoever downvoted you. Add knowledge to the discussion instead of
downvoting someone you disagree with. [0]
[http://stackoverflow.com/questions/849416/evaluate-quoted-
ex...](http://stackoverflow.com/questions/849416/evaluate-quoted-expression-
in-f)

------
msutherl
Microsoft scares me, for no good reason. Would, say, a Ruby or node.js-
oriented web developer find the F#/.NET community lacking, incomplete,
unfriendly, uncool? Is there even a community to speak of?

What's to stop a young developer from going against the grain and adopting
.NET?

(Here come the downvotes. Shun the "hipster." But really, I'm looking for a
subjective perspective from somebody on "the other side." I don't even know
how to search for ".NET" on Github. For instance, is NuGet anything like npm
or gem?)

~~~
bad_user
From my experience thus far the .NET community is not friendly to open-source.
Yes, open-source projects do exist, but those are few and far between, being
either ports from the Java world, or throwaways that failed as commercial
projects. There are also instances of bait and switch, as in projects starting
as open-source being closed later (e.g. ServiceStack). Also compare RoboVM.com
with Xamarin.com. If you'll dig into the details, you'll see similarities
(like comparable pricing), with one important difference ... RoboVM is open-
source and you only need a subscription for extra goodies. Same thing with
IntelliJ IDEA versus Visual Studio. I find this difference to be the essence
of the .NET ecosystem versus the others.

You mentioned NuGet, which is like `gem`. Well, the build tools in .NET land
suck really badly. You've got MSBuild, which is like Ant or Make and that's
what everybody uses, because development in .NET-land is Visual Studio driven.
What you don't have for example is something like Maven (or SBT, or Lein).
There's been nothing like it in .NET land. The ASP.NET developers have been
building an alternative, in the form of dnvm / dnx / dnu, but it's just
getting started, being a work in progress and feeling hack-ish and incomplete.
Fingers crossed.

Anyway, in spite of the fact that there are companies that have built their
own build tools because the current status quo sucks so badly (and I know more
than one), the .NET community is filled with closed-minded folks that will
never admit that their tooling sucks and I'm even including Visual Studio
itself in this mix, since an IDE that needs extra investments into ReSharper
is not that good in my opinion.

And then there's Mono, the current cross-platform implementation and the
answer to folks that want to develop and deploy on Linux, OS X, Android or
iOS. Except that Mono is and has historically been full of bugs. Like if you
want to do server side development and deploy on Mono, just forget about it.
And these days Xamarin is focusing only on mobile development and the
community is dead.

> _Would, say, a Ruby or node.js-oriented web developer find the F# /.NET
> community lacking, incomplete, unfriendly, uncool? Is there even a community
> to speak of?_

The answer in my opinion is yes. This may change, given recent efforts by
Microsoft, however evolution will be slow because the whole ecosystem has to
change, not just Microsoft.

~~~
moonchrome
>being either ports from the Java world, or throwaways that failed as
commercial projects

This is blatantly false. Just on my current project I'm using :

* OpenTK - opensource API around OpenGL

* ReactiveUI - opensource MVVM framework using RX for databinding

* Command Line Parser Library - opensource, does what it says

* NLog - logging library

* sqlite-net - micro ORM for sqlite

I excluded :

* RX - opensource but comes from Microsoft so not a community, but also a nice counterexample of porting from .NET to JVM as RX was innovated on .NET and later ported to other platforms

* system.data.sqlite.org - opensource .NET sqlite implementation, arguably a port from a bigger project

And that's just the references I have in my current project, there are a bunch
of open source .NET projects that do cool things, for eg. MonoGame, bunch of
MVVM frameworks, etc.

~~~
reactor
You are just proving what OP says "the .NET community is filled with closed-
minded folks that will never admit that their tooling sucks". Unfortunately,
you are not seeing the whole picture.

~~~
moonchrome
What ? I developed web applications with Clojure/CLJS Python/Django, I did C++
development for years and a large part of the code in my current project is in
Python because the tool we use (Blender) uses Python as a scripting language.

I agree that .NET has less opensource tools because a lot of things are just
provided by Microsoft out of the box, and there are many areas it's not
popular - but there are many OSS projects and they match the things I saw in
Python and Clojure community.

I would say his posts proves another point - a lot of people in open-source
are unfriendly to .NET because of Microsoft origin and they like to spread
FUD. I remember when Mono was getting started and every thread on every news
board would bring up how it's "patented/copyrighted" even when Microsoft gave
.NET community patent promise and made CLI a standard.

When I contributed patches to Mono and talking to other .NET developers on
social networks I never saw this "unfriendliness towards OSS".

~~~
crdoconnor
>there are many OSS projects and they match the things I saw in Python and
Clojure community.

Where's the Django for .NET?

~~~
moonchrome
ASP.NET MVC ?

~~~
crdoconnor
Does the same sort of thing, but is not _nearly_ as good.

~~~
kirse
Seems to work just fine for StackOverflow... Then again, maybe 560M pageviews
per month on 9 web servers isn't _nearly_ enough for your high-level app
requirements. They've stayed with ASP.NET MVC since at least v3 back in 2008.
Current [1]:

    
    
        - IDE Visual Studio 2012 & 2013
        - Framework Microsoft ASP.NET (version 4.0) on .NET 4.5
        - Web Framework ASP.NET MVC 5 with MiniProfiler
        - View Engine Razor 3
        - Browser Framework jQuery 1.7.1
        - Data Access Layer LINQ to SQL and Dapper
        - Cache / Additional Data redis 2.8.4 via StackExchange.Redis, with serialization via protobuf-net
        - Source Control Git using a self-hosted GitLab instance (previously Mercurial from 2010–2014, Subversion from 2008–2010)
        - Compare Tool Beyond Compare 3
    

Disqus on the other hand (originally based on python/Django) sounds like
they've rewritten a lot of their core components into Go. [3] At the end of
the day any solid web framework will still need caching thrown in front of it
along with high levels of custom tailoring. Both Disqus and SO have done that.
Either way the .NET stack has long since proven itself as a capable
foundation.

[1]
[http://meta.stackexchange.com/a/10370](http://meta.stackexchange.com/a/10370)

[2]
[http://stackexchange.com/performance](http://stackexchange.com/performance)

[3] [http://highscalability.com/blog/2014/5/7/update-on-disqus-
it...](http://highscalability.com/blog/2014/5/7/update-on-disqus-its-still-
about-realtime-but-go-demolishes.html)

~~~
crdoconnor
I was referring to its terseness, simplicity, extensibility and the large
ecosystem surrounding it.

I said that Django is a better framework for _this_ reason, not _your_ straw
man reason.

Scalability is barely an issue. You can horizontally scale both frameworks
virtually endlessly if you maintain application statelessness. Dick measuring
contests about which company uses what and has the most pageviews do not
contribute much to the discussion. Are you going to argue that PHP is a good
language because Facebook has a billion users?

~~~
kirse
_I was referring to its terseness, simplicity, extensibility and the large
ecosystem surrounding it. I said that Django is a better framework for this
reason, not your straw man reason._

You're going to have to link me to the comment where you "referred to" and
"said" all of that, because this was all I saw:

 _Where 's the Django for .NET?_ and _Does the same sort of thing, but is not
nearly as good._

So maybe I got foolishly got myself into this by bothering to respond to two
zero-effort comments. It wasn't a dick measuring contest, the point of the
exercise was to examine that a .NET stack (including ASP.NET MVC at its core)
can be executed upon with finesse and tuned to efficiency at high operational
capacity. Futhermore, other frameworks (i.e. Django) aren't short of their own
troubles.

------
sremani
Reading some of the comments, I cannot but think about the book I am reading
"The Expert Beginner". This platform/framework street fighting is not good for
any one. If you are on LAMP stack, Ruby on Rails or Python or Go, where you
code on a Mac OS X, and want to engage in a narcissistic exercise of self-
validation, please do it else where. If you are curious about the other side
of the tracks, there are enough knowledgeable people who can help, advice and
guide in this very forum.

