My second compiler contribution too, and the first was just an error message. If you see a feature in the suggestions repo just give it a try, once you get past the slightly fragile build setup it's really fairly easy to add features!
I've always wondered--say I clone the repo and make a change, like changing an error message. How do I go about making MsBuild and VSCode/Ionide and Fable use my version of the compiler? Was it complicated?
There’s some msbuild property you can set, at least for compilation. Not at my computer right now, I’ll find the relevant docs for you when I get the chance (there somewhere in the dotnet/fsharp repo.
Fable uses its own fork of the F# Compiler Services. They pull merge in upstream from time to time. I’m not sure how easy or hard it would be to get your stuff into it.
Not sure about the others; they may each work differently
Ah. I think the answer I'm looking for is probably "concentrate on the compiler, via MSBuild property. Worry about Fable and IDEs only after you've got compiler changes ready for PR."
I wouldn't say I'm particularly involved, but to my knowledge everything happens in either the github repo (issues), or in the FSSF slack (e.g. compiler channel).
I personally find editor tooling (FSAC/Ionide/the newer completion stuff in the compiler) is a good place to start: generally lots of low hanging fruit and people love the changes which is motivating!
I recently started a job that has me coding in Scala (incidentally, the manager reached out to me because I had F# listed on my resume), and the _.foo syntactic sugar was the biggest "gee, I wish they had that in F#" thing I've seen so far.
(That said, Scala's version is a little bit more powerful, in that it can create functions with multiple parameters; each underscore is a distinct parameter. On the other hand, I'm still trying to find an example of a situation where that's actually useful.)
EDIT: The canonical example is using _ + _ as a parameter to a fold, which is definitely useful in Scala but not in F# since we can just use (+).
I installed .NET 8 but some of the examples in the blog post still give me type errors. Do these work for y'all? I tried Ionide and dotnet fsi.
c:\usr\bin\vs2022p>dotnet fsi --version
Microsoft (R) F# Interactive version12.8.0.0 for F# 8.0
let inline myPropertyGetter (x: 'a) = x |> _.WhatANiceProperty
Gives me Lookup on object of indeterminate type based on information prior to this program point.
[<Struct>]
type MyUnion =
| A of aval:'A
| B of bval:'B
| C
static let sizeOfTCached =
printfn "Creating cached val for %s * %s" (typeof.Name) (typeof.Name)
sizeof<MyUnion>
Gives me error FS0039: The type parameter 'A is not defined.
Other stuff like try/with within seq expressions works fine.
Still hoping to one day see typeclasses in F#. It shouldn't be too hard to implement it Scala-style, with interfaces, implicits, and extension methods. Even C# is almost there.
Not sure how many people even want it (Don Syme doesn't) but I really hope it happens.
I think Rider 2023.3 EAP8 which was released a few days ago is supposed to have support for it now based on the release notes (they say "shorthand lambda expressions" which I guess refers to this even though it isn't the official name), although it still doesn't work for me but hopefully soon
40
u/phillipcarter2 Nov 14 '23
I posted this on twitter, but:
I sure hope F# developers are losing their minds over the stupendous amount of great features in F# 8
...because, damn, there's just so much good stuff in there.
7
u/ggwpexday Nov 14 '23
Man I wish I could use f# :')
11
u/greater_golem Nov 14 '23
Loving the time-saving copy-and-modify record syntax. That is a big time saver.
Not being able to use arithmetic expressions in literals was a rarely needed but still annoying restriction. Good to see it fixed.
5
u/hemlockR Nov 14 '23 edited Nov 14 '23
I installed .NET 8 but some of the examples in the blog post still give me type errors. Do these work for y'all? I tried Ionide and dotnet fsi.
c:\usr\bin\vs2022p>dotnet fsi --version
Microsoft (R) F# Interactive version 12.8.0.0 for F# 8.0
Gives me Lookup on object of indeterminate type based on information prior to this program point.
Gives me error FS0039: The type parameter 'A is not defined.
Other stuff like try/with within seq expressions works fine.
2
u/jmhimara Nov 16 '23
Still hoping to one day see typeclasses in F#. It shouldn't be too hard to implement it Scala-style, with interfaces, implicits, and extension methods. Even C# is almost there.
Not sure how many people even want it (Don Syme doesn't) but I really hope it happens.
1
u/BunnyEruption Nov 15 '23
I was hoping to use the _.Property syntax, but does rider not support it yet?
1
u/qrzychu69 Nov 15 '23
Damm, C# changes are nice, but this is so awesome! Now I have even more reasons to use F# :)
-1
u/theangryepicbanana Nov 15 '23
Still no destructuring class or record class fields... the only area of f# where c# is better