Live data from Hacker News

.NET Fiddle adds F#

dotnetfiddle.net

61–70 of 72 posts

Re: .NET Fiddle adds F#

#61
post #30

Earlier quoted context omitted.

Why? What makes it better than C# in web Web API area? (honest question)

In my own tests, F# will require about 1/20th of the type annotations of C#. It offers a near superset of functionality, so you don't lose anything (except a bit on the tooling side of things). The lightweight syntax, easy handling of functional features, nesting of code - it ends up leaving you with far less code that has less bugs by default. MS describes F# as excelling at "programming in the small" - the line-by-…

>At the moment, MS seems to have sort of backed off on enhancing C#

I assume you are talking about enhancing C# itself, because Roslyn is the next big thing for C# (and VB.Net) with a compiler compiler rewrite that will allow anyone to build language services.

The C# compiler code base is old now. It was done in C++ and apparently has become very hard to maintain. The C# team has been working on Roslyn, a complete rewrite of the compiler in C#, to make adding new features to the language more easily. It will also allow improvements to tooling (anyone can use the same compiler service rather than create their own) and should certainly facilitate meta-programming, construction of DSLs, etc.

I agree with you about F# though. It's so much to-the-point than C#, which is already a big improvement on java and C++ in the terseness area.

I love C# but I wish I was at least as proficient in F#, I know I could be a lot more productive with a language that requires less 'ceremony'.

Re: .NET Fiddle adds F#

#62

Cool to "see" F# in action. Like the union types, but not so much the list operations; seems more natural to: [1;2;3;4] filter isEven sum vs. List.filter isEven [1;2;3;4] |> List.sum in Scala it's: List(1,2,3,4) filter isEven sum Of course I'm not familiar with F# so don't know all of the WIN within (Type Providers, for example, are very impressive, would love to see that on the Scala side of the fence one day).

The reason is that f# using the .net type system has no higher kinded generics. So you can abstract over t in List but not over u in u.

Re: .NET Fiddle adds F#

#63
post #61

Earlier quoted context omitted.

In my own tests, F# will require about 1/20th of the type annotations of C#. It offers a near superset of functionality, so you don't lose anything (except a bit on the tooling side of things). The lightweight syntax, easy handling of functional features, nesting of code - it ends up leaving you with far less code that has less bugs by default. MS describes F# as excelling at "programming in the small" - the line-by-…

>At the moment, MS seems to have sort of backed off on enhancing C# I assume you are talking about enhancing C# itself, because Roslyn is the next big thing for C# (and VB.Net) with a compiler compiler rewrite that will allow anyone to build language services. The C# compiler code base is old now. It was done in C++ and apparently has become very hard to maintain. The C# team has been working on Roslyn, a complete re…

Right, I'm referring to the fact that C# 3 added LINQ, but with the bare minimum of features for LINQ. Type inference, for example, is purely for anonymous types and the LINQ extension methods. They never went back to clean those up since V3, and it doesn't seem like they care.

Maybe this magical Roslyn rewrite is going to enable all sorts of amazing things, and then C# will rapidly catch up. But from the outside, it feels like C#'s good enough (hey, it's better than Java), and MS is content to keep it that way.

Re: .NET Fiddle adds F#

#64

Earlier quoted context omitted.

I think there is a huge way between allowing developers consume F# code from C# and importing all the ugliness of stuff like static members into the language. I don't think it has to be that way. What's the value of having a runtime with a language-independent intermediate representation if one just adds half of C#'s complexity into F#?

Q: What's the difference between a static method and a function that belongs to a module? A: One's object-oriented jargon, the other's functional jargon. They both mean pretty much the same thing.

So why have both in the language?

Re: .NET Fiddle adds F#

#65

Earlier quoted context omitted.

But currying isn't even consistently supported, e. g. when calling C# APIs as far as I remember. Wouldn't it have been better to explore a way which either works for all code or, if that doesn't work out, just embrace instance methods? The current API situation looks kind of weird. What's the point of having an API (like the collection one) which is meant to be chained together, but needs additional boilerplate (|>)…

> Wouldn't it have been better to explore a way which either works for all code or, if that doesn't work out, just embrace instance methods? I suppose the answer to that question ultimately depends on one's preferences. I like F#'s way of doing things because I like functional programming and idioms, but I also like being able to play nice with a rich pre-existing ecosystem, and don't want to have to do it through a…

It seems to be kind of insane having to choose between a "better functional" and a "better OOP" language. Why not just combine the good parts into a single language.

That would probably be more consistent than the current 80%OCaml + 50%C# => F# mess.

Re: .NET Fiddle adds F#

#66
post #60

Earlier quoted context omitted.

List(1,2,3,4) filter isEven sum println error: type mismatch; found : Unit required: Numeric[?] List(1,2,3,4) filter isEven sum println ^

`sum` does not accept a function as a parameter, the original example had an `foreach` instead of `sum`. list filter isEven foreach println As a side note omitting that many commas and parenthesis is very rare at least based on the Scala projects I've worked on. The above example is equal to the one below: list.filter(isEven).foreach(println)

Good points, I tend to mix it up, rarely going parens-free style, but also not parens by default either.

If you wanted to be really explicit you could do:

    list.filter(x=> isEven(x)).foreach(x=> println(x))
yuck ;-)

Re: .NET Fiddle adds F#

#67
post #60

Earlier quoted context omitted.

`sum` does not accept a function as a parameter, the original example had an `foreach` instead of `sum`. list filter isEven foreach println As a side note omitting that many commas and parenthesis is very rare at least based on the Scala projects I've worked on. The above example is equal to the one below: list.filter(isEven).foreach(println)

Good points, I tend to mix it up, rarely going parens-free style, but also not parens by default either. If you wanted to be really explicit you could do: list.filter(x=> isEven(x)).foreach(x=> println(x)) yuck ;-)

That example is not quite equivalent, because now you are not passing `isEven` or `println` as arguments, you are passing anonymous functions that call `isEven` and `println`.

Re: .NET Fiddle adds F#

#68

I found F# to be rather neat. This is a great way to see for yourself.

I've done very little but it seems really concise. I like that. One place some predict it will emerge is in the Web API arena, and I could totally see that happening.

Outside of web development any ideas what I could use it for (I am on Linux so it should run on Mono)? I've done quite a lot of web development on the JVM with Clojure, Scala and Java and would like to try to do something totally different with F#.

Re: .NET Fiddle adds F#

#69
post #68

Earlier quoted context omitted.

I've done very little but it seems really concise. I like that. One place some predict it will emerge is in the Web API arena, and I could totally see that happening.

Outside of web development any ideas what I could use it for (I am on Linux so it should run on Mono)? I've done quite a lot of web development on the JVM with Clojure, Scala and Java and would like to try to do something totally different with F#.

Linux install instruxtions are at the F# website[1]. As for what you can use it for... anything you can use C#/mono for?

[1] http://fsharp.org/use/linux/

Re: .NET Fiddle adds F#

#70
post #68

Earlier quoted context omitted.

Outside of web development any ideas what I could use it for (I am on Linux so it should run on Mono)? I've done quite a lot of web development on the JVM with Clojure, Scala and Java and would like to try to do something totally different with F#.

Linux install instruxtions are at the F# website[1]. As for what you can use it for... anything you can use C#/mono for? [1] http://fsharp.org/use/linux/

I have it installed and I've even dabbled with it a bit, but I am looking for some task where it would shine compared to JVM languages.
Post reply on HN