News for hackers. Stuff that matters.
Re:Show HN: C# 6.0 Functional Language Extensions by saosebastiao on Wednesday November 19, 2014 @01:58PM (#8631875)
Beautiful. I've been trying to pick up C# simply due to Xamarin, and this definitely looks like it will make me feel more at home. Has anyone had success with 6.0 on Xamarin? (Is it even out yet? I saw announcements, but they looked like previews).
Re:Show HN: C# 6.0 Functional Language Extensions by nbevans on Wednesday November 19, 2014 @07:21PM (#8633657)
Just use F# from Xamarin. It's the real deal. C# is just a stop-gap measure to suck in the enterprise devs.
Re:Show HN: C# 6.0 Functional Language Extensions by nmgafter on Wednesday November 19, 2014 @09:23PM (#8634071)
I beg to differ. C# is a perfectly usable tool to introduce you to programming until you're ready to move on to F#.

Wait, did I just agree with you?

-Neal (Roslyn team)

Re:Show HN: C# 6.0 Functional Language Extensions by louthy on Wednesday November 19, 2014 @09:34PM (#8634103)
How's the pattern matching spec coming along? ;)
Re:Show HN: C# 6.0 Functional Language Extensions by saosebastiao on Wednesday November 19, 2014 @07:56PM (#8633789)
Except that all the docs are in C#, which means if I want to consult them, I have to either know C# or know how F# interops with C# (and therefore understand C#). Trust me, I would love to, but I don't have the time to learn two languages for one project.
Re:Show HN: C# 6.0 Functional Language Extensions by MichaelGG on Thursday November 20, 2014 @12:19AM (#8634519)
There is essentially no language specific documentation in well made APIs. There is a common type system so there is very little that's different. Mainly if you need a semicolon and how you prefer your parentheses.

There are some poorly made APIs, like ASP.NET MVC that exploit C#-specific side effects to compensate for C#'s verbosity. These APIs ignore the common type system and just pass object everywhere, breaking tooling and type safety.

But as long as Xamarin didn't come up with terrible designs, you're all set. And, even if they do rely on something strange, F# is such a better language, that the small setback of dealing with interop (which doesn't require learning C#) is totally worth it.

Re:Show HN: C# 6.0 Functional Language Extensions by icedog on Thursday November 20, 2014 @02:59AM (#8634770)
I'm an F# developer, but still decided to not use F# to build an android app. Dealing with the UI libraries like support.v4 was just too painful from a functional perspective. If you don't need any object oriented dependencies, then it's smooth sailing.
Re:Show HN: C# 6.0 Functional Language Extensions by CmonDev on Thursday November 20, 2014 @05:25AM (#8635098)
F# is not meant for implementing the complete app anyway. Just use it for business logic where it makes sense.
Re:Show HN: C# 6.0 Functional Language Extensions by MichaelGG on Thursday November 20, 2014 @09:55PM (#8639566)
I've only heard that in context of A: missing tooling, B: Microsoft, in their quest to make customers feel C# is still the real language and F#'s just some science toy. I've used F# for a Web UI via WebSharper and it was lovely. It's just a poor reflection on the state of UI kits if they don't work with F#.
Re:Show HN: C# 6.0 Functional Language Extensions by CmonDev on Friday November 21, 2014 @04:58AM (#8640575)
"It's just a poor reflection on the state of UI kits if they don't work with F#." - well at least they don't start using lower-case names randomly.
Re:Show HN: C# 6.0 Functional Language Extensions by louthy on Wednesday November 19, 2014 @08:06PM (#8633819)
Out of interest what language are you coming from?
Re:Show HN: C# 6.0 Functional Language Extensions by saosebastiao on Wednesday November 19, 2014 @08:17PM (#8633850)
I'm all over the map. My day job requires tons of quick and dirty data analysis or concept prototyping which tends to get thrown away, which moves me towards declarative langugages (lots of SQL and Prolog) as well as pragmatic dynamic languages (Clojure,R,Ruby). But if I'm actually building anything that is meant to last more than a month, I tend much more strongly to an ML philosophy. Currently that is mostly Scala and some Rust, but I've been wanting to play with F#/OCaml for a long while.
Re:Show HN: C# 6.0 Functional Language Extensions by louthy on Wednesday November 19, 2014 @09:01PM (#8633991)
You might want to consider F# over C# then, there's very little cognitive barriers to using the .NET framework with F#. For example:

    open System.IO                 // F#

    using System.IO;               // C#
    

    let thing = new Thing(a,b,c)   // F#

    var thing = new Thing(a,b,c)   // C#


    Console.WriteLine("blah")      // F#

    Console.WriteLine("blah")      // C#
Essentially C# parameter lists become tuples in F#. So interop is mostly quite straight-forward. It's mostly quite a mechanical process to convert C# sample code into F#.

It's harder to go the other way, and take F# code into the C# world, because functions in F# allow for partial application. The type inference system is awesome, so you'll end up with more generic functions and use first class functions more. That stuff is tricky to bring back (though not insurmountable).

The OO grammar is a little tricky in F#, but I tend to shy away from that. It's not needed most of the time.

Then at least you don't have to deal with all the stuff this library is trying to solve ;)

Re:Show HN: C# 6.0 Functional Language Extensions by CmonDev on Thursday November 20, 2014 @05:24AM (#8635095)
Exactly the kind of attitude that hinders the F# growth.

I mean F# is a pretty useful numeric DSL, but let's not blow things out of proportions. Modern languages have R#-like refactoring tools.

Re:Show HN: C# 6.0 Functional Language Extensions by sandyarmstrong on Wednesday November 19, 2014 @02:19PM (#8632021)
Many C# 6 features work in Xamarin's compiler, but aren't necessarily understood by the IDE, for example. `using` static classes and the ?. operator both work.