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.
http://fsharp.org/use/mac/ is probably a good place to start - if it doesn't work for you for any reason, do please complain - the community is really active in trying to make everything better! (The general section on cross-platform development may also be helpful - perhaps more when you've got a little way in!)
Additionally, there's an F# room on http://fpchat.com/ (a Slack group dedicated to functional programming) and you'd be more than welcome to come and ask questions there too - I recommend that venue in particular as it's very active at the moment.
Hopefully that's enough to have a play - reply here if I can help at all too.
As per language Expert F# from Apress by Don Syme et. all is a pretty solid practically oriented introduction. As for how to use the language most Ocaml and ML oriented books should offer hints. F# is a bit more extensive of course but how the language originally appeared it was "Ocaml for .Net".
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.
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.
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?
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).
It is kind of funny that F# 4.0 got to the top of Hacker news while F# 3.0 with the type providers (which is an amazing innovation, if you ask me) didn't get that much publicity when it came out.
I think it's just a matter of timing. Now that the F# community is getting bigger (see number of user groups at http://c4fsharp.net), more stable (see the F# Foundation http://foundation.fsharp.org), and Microsoft is becoming more open (reinforcing the already much more open F# space), it is just a good time for looking into F#. And F# 4.0 announcement is a good excuse for that :-).
Though F# 4.0 is the first version of the language designed and developed in a fully open way, which is pretty amazing change - and more important than many language features that could be added to F#.
F# 4.0 makes me excited to be using the language even more. I just started learning back in December after not really enjoying my Python learning experience and have found F# to be such a joy. Your book is one of three at my desk. I've done about 8 years on the .NET stack and Microsoft as a whole has really impressed me these past couple years.
Anyway, thanks for all the work you have put into making the F# community one that is thriving and active! I see your name everywhere when I'm Googling for F# stuff and it's obvious you are one of those 20-percenters doing 80-percent of the work!
"The .NET framework supports up to 32-dimensional arrays, but in the past F# only supported use of up to rank-4 arrays. Not only were arrays of rank 5+ not possible to create and manipulate from F# code, the compiler could sometimes fail to consume external libraries which relied on high-dimensional arrays.
This is now fixed. Although there is not yet support for creating and manipulating high-rank arrays, the compiler will now properly handle these types up to rank-32."
Has anyone here ever used "high-rank" arrays? The deepest I've ever gone was 4 for a lookup table, but I'm wondering what the use-case is for super high depth arrays as well as why there is a limit at all.
I contributed the fix for the high-ranking array support.
The main reason for the fix was because F# pre-4.0 can't reference overloaded methods where one or more of the overloads has one or more parameters which is an array of rank 5 or more. I had a 3rd party DLL I wanted to reference, where a class had generic overloads for all of the array ranks, e.g.,:
Even though I was only trying to use MyClass.Foo(T[]), the F# compiler's overload resolution failed due to the presence of the higher-ranked array types.
I'm not planning to use such arrays any time soon, but I wanted to make sure that if other code was using these arrays I could reference it from F#.
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.
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?)
I hope you don't get downvoted, those seems like reasonable questions. I'm part of the F# community I guess, so I suppose I could try and answer!
I'm not sure the F# community is the same as the broader .NET community. I think at the moment, with functional programming being a little more niche still, it's perhaps quite self-selecting. It has a lot of people in who really care. I think that's a good thing - I hope - but obviously the broader .NET community is perhaps more heterogenous - it can feel quite enterprise-y or business-y in places, unsurprisingly.
I hope the F# community wouldn't be found lacking, unfriendly, etc. We certainly try hard to be welcoming and inclusive, and I think generally do OK - although we could do better I'm sure, as could every community. There probably isn't as much open source in the .NET world as there is for Ruby/Node as much as anything else because of the backgrounds of the languages and communities (Microsoft has a strong influence over certain parts) but there is still quite a lot, with some very enthusiastic smart folk.
What's stopping people adopting it? Probably too long an answer for here. I would say that I think there are fewer and fewer things preventing adoption as time goes on, especially with F#, and there are some cool startups trying to do big things.
I'd like to think it's friendly, and I'd also like to think it's always open to ideas from other communities. If you wanted to chat as Ruby or Node dev (or anything else) I hope you'd be welcomed.
(Final note - NuGet is kind of like NPM yes - it's a common binary packaging form for dependency management. It has flaws, but is commonly used, and is certainly better than nothing. In the F# world at least, Paket is doing very well - it's compatible with NuGet packages, but perhaps slightly more accurate about using and managing them!)
You can run .NET Core on OS X[1] (and Linux, FreeBSD and Windows). There are plenty of rough edges still, but we're adding more functionality and making it more capable each day. Soon enough, all the .NET Core ports will be just as capable as the Windows version.
ASP.NET 5 still runs Mono by default on OS X, but you can switch to .NET Core with the DNVM tool [2].
Note the blog post from yesterday by the F# team on F# 4. [3]
There are some hello world examples in the repo listed above as well.
If you'd like, you can develop with the recently announced Visual Studio Code, announced ~yesterday.
I think this is still Mono, but full MSFT support of *Nix is said to be underway.
Also, if you use Yeoman, make sure you upgrade your aspnet generator. I had issues until I realized the version I had was generating a project with out of date dependencies.
If I may, I think you're harvesting downvotes (very light grey as I write this) because your phrasing could read that Microsoft the company is frightening you because they're the Big Evil, etc... this being one of the inevitable (and inevitably tiresome) derailing comments that enters any thread about Microsoft and immediately gets downvotes because Boring.
After I re-read your comment it seemed you might be saying Microsoft tech intimidates you, perhaps because of the perception of it being big enterprise, dominated by Chief Poobah Architects, etc.
That's fair. I say Microsoft "scares" me because it's historically "uncool," which means it's likely that the (open source) developer community is less dynamic and comprehensive. People are rightfully picky about the work they do for free!
It used to scare me because it abused its market dominance in much the same way Google does and because its ultimate end goal is inevitably end user lock-in, which is something I want to avoid at all costs.
It's true that they have changed over the last couple of years and have adopted open source, etc., but it seems to me that this isn't really because they've become intrinsically "less evil" - it's just because the market has forced their hand, and they now have to choose between future irrelevance and not being evil now.
I am pretty confident that if they once again gain a powerful monopoly like they used to have, they'll abuse it just like they did the last time.
One way they could do that is to bait and switch on open source/linux versions of .NET.
I've looked at F# and it is a nice language, but I don't really want to do any OSS development on it unless Microsoft somehow convinces me with a license that handcuffs future Microsoft so that they won't be able to do that (e.g. GPL, assuming that would work. IANAL).
This is almost an aside, but you should take a look at some of the stuff that comes out of Microsoft Research. They employ some of the biggest names in Haskell (Simon Peyton Jones for one) and have done some really interesting and bleeding edge work.
It is somewhat lacking in the community. What's there is quite friendly, cool, and often doing neat things. There just isn't as many libraries as, say, Python, because there aren't as many people.
I'd say learn the MS ecosystem for the same reason I learned Linux way back when: a different perspective.
You'll see all the same things, but sometimes done a different way. Not necessarily better or worse, just different. I'm pretty confident you'll have at least one "that's a great way to do that" moment.
Maybe you'll come away from the experience much as I have: I don't really care what the tech is. Will it do what I need it to? It also has made picking up "new" tech (ain't nuthin' new) really easy.
Oh, and search for "dotnet". Most places use that. Google will search for ".net" if you add in "C#" or something.
Hunh? C# was one of my first professional languages and I used it for five years. It's an excellent language and many people use it. What 'grain' do you think you are going against?
The more platforms and languages you get exposed to, the more informed choices you'll be able to make in the future.
The .NET community is extremely large, perhaps you run in a small circle.
A job search on indeed.com (a job listing consolidator) within 25 miles of my area, Santa Monica, CA reveals
2,477 jobs for .NET
2,083 jobs for Java
1,284 jobs for python
685 jobs for Ruby
Here are # of questions with following tags on StackOverflow:
Java: 845,330
C#: 786,850
Python: 417,737
Ruby: 132,074
I can't speak for the rest of the world, but I would guess if you looked at 200 of the largest companies in Los Angeles, 90% of them have at least some .NET code running for something. It's pretty ubiquitous.
Damn would I like to live somewhere that has 1284 Python jobs listed, over here in the UK .Net (outside the web) dominates, love me some C# but Python just isn't on the radar at all (yet it's widely used internally).
Not everyone is a web developer or working on mobile apps.
Games and business software are two huge industries which are almost entirely Windows. Everyone using the massively popular Unity engine is a C# developer.
I've been developing with F# for about 4 years now, and ever since the beginning I've found the F# community to be wonderfully helpful and friendly. The community is, for sure, smaller than the Ruby or node.js communities but I think that's kind of nice since it makes it easier to get to know everyone personally.
If you're interested in F#, or even if you just want to dip your toe in, I recommend checking out your local F# meetup. I've learned a lot there over the years and made some great friends too.
F# in particular is not a 'mainstream' .Net language, its community is more similar to the Haskell community than the general .NET community.
For a young developer in 2015 really no reason not to use .NET. Other than its just not as popular, which is good enough reason.
For older folks the main stumbling block is... Microsoft has run long and brutal cons before. If your memory is long you just don't trust them.they are doing everything right... But still.
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.
>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.
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.
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".
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.
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?
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.
Theres a lot of negativity here that I won't comment on, though I'd be curious to hear where the author is coming from (what was the source of his/her experience with .NET). They may certainly know more than I do.
As for open source community, we have real data available so there's no need for debate: http://githut.info/
As of Q4 2014, C# was number 10 in langs by number of active repos, with 56k (compared to, say, 85k for C++). Came in ahead of ObjC, R, Go, and others.
It may not be JavaScript, but it's active. If you look at the other stats you'll see these really aren't dead repos either.
> since an IDE that needs extra investments into ReSharper is not that good in my opinion
A lot of people choose ReSharper for "nice" things that often times aren't buying them a whole lot in terms of productivity (e.g. "turn this foreach() loop into a Select() statement" really doesn't buy one much). I'd hardly say that one needs ReSharper to get the full Visual Studio experience.
With the latest versions of Visual Studio (>= 2012), I agree with you, but 2010 and prior still didn't have a lot of the Go To Symbol fuzzy search features that VS now has out of box.
Regarding the LINQ refactors you mentioned, I'd say those are less about gaining productivity than it is to educate the developer in how code can be refactored. A lot of times, those LINQ refactors turn out considerably less readable, but it's a moment to learn other ways of solving problems.
>... 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.
That's a fair point, but even so, I've yet to find an IDE/editor/whatever that compares favorably to the combination of Visual Studio + Resharper + NCrunch.
I'm one of those devs who is loathe to admit our tooling sucks. I hate MSBuild. Love NuGet, it's so much more than just a library package manager. Chocolatey, plugin provider for other apps, and you can even use it to dynamically download behavior at runtime and load and execute it. Love VS and ReSharper. I used VS for about 1.5 years w/o resharper and thought it was loads better than everything else i had done, and resharper just makes it better.
I am really a total C# fanboy, though was reared on unix and c/c++/python/java.
> > 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.
A suspicion gnaws at me. I try to rid myself of it but alas, it holds fast and unyielding. That suspicion being: you know very little about the F# community. What statements you make, they seem descendents of generalizations from your experience with the .Net community. Happily, F# is not like the stereotypical .NET community (I must be so specific, in order that I not offend the subset to whom your claims do not apply). There is a strong culture of embracing open tools and code; Microsoft is not looked at for direction beyond what basic support they provide.
The community is neither lacking nor is it unfriendly. It is small, yes. Uncool? Opposite of! But opinions run with tastes. Incomplete is a tricky matter. Certainly it's not going to have as many libraries as Python or the JVM, but neither is it some kind of backwater.
There are tons of cool libraries available, most of them open source, with generous licensing terms. Stuff with Haskell heritage like fparsec, fscheck, the blazing fspickler combinators (serializer) or more computation oriented tools that let you target and run on the GPU or Here: Automatic Differentiation (after which, loss minimizing Machine Learning algorithms are made much easier) [http://gbaydin.github.io/DiffSharp/]. Or the DataFrames library: http://bluemountaincapital.github.io/Deedle/
Type providers also allow easy use of UI builders. Web frameworks and also, js targeting can be reached here: http://fsharp.org/guides/web/. You can target Unity3D and apparently, also the Unreal Engine.
There are interesting projects looking at distributed computation (https://github.com/fsprojects/Cricket and ilk) or light weight concurrency, in Hopac's take on the Pi Calculus.
F# was one of the earlier languages with light weight threads, a solid async story and first class events (pre-reactive trend). Active Patterns (not unique to F# but more common in) take us close to Predicate Dispatch (http://c2.com/cgi/wiki?PredicateDispatching). There is much more I could list and hopefully, I have piqued some interest.
But it's not perfect. Adding Functor support would be very useful. A while ago, in an early Active Patterns paper, there were hints that generalized algebraic datatypes might soon be introduced. Nothing came of that. Higher kindedness is nice but not as much missed—it is my suspicion that, the gains from each level of types that can be parameterized over, quickly saturates.
There are lots of cool projects going on in F#, and while, as a language it's definitely not as powerful as say Scala or Haskell; the tools, libraries and environment, alternate ideas as well as breezy syntax, do make up. Having used them all, I wouldn't say it is any less expressive, it just...prioritizes differently beyond the core functional ideas (REPL, sum/product types, currying, closures, point free application where possible, Hindley Milner inference, immutability by default, pattern matching and deconstruction, etc., etc.).
It strikes a lot of middle ground across many planes, in terms of pragmatism vs functional purity—that is its ML heritage (but perhaps even more so, bargained in exchange for the .NET ecosystem). Most functional languages focus on types in terms of algebra, F# does too but only basically, instead it focuses more on the easy bridging of types with unruly data.
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.