fable-compiler / Fable

F# to JavaScript, TypeScript, Python, Rust and Dart Compiler
http://fable.io/
MIT License
2.93k stars 301 forks source link

Updated FCS to .NET/F# 9.0 + Prepare Fable 5 alpha #3957

Closed ncave closed 4 days ago

ncave commented 1 week ago
ncave commented 1 week ago

@MangelMaxime This is just a first pass. We may want to update the Fable CLI to .NET 8.0, now that .NET 6.0 is no longer supported. There are quite a few security warning for old dependencies that need to be updated.

Before we merge this, do you mind publishing a new Fable release with all the pending changes that have already been merged?

ncave commented 1 week ago

Here is perhaps why the Analyzers build fails: https://github.com/dotnet/sdk/issues/44868 We may have to disable it until it's resolved.

Update: Switching the analyzers build to Linux makes it work.

MangelMaxime commented 1 week ago

Hello @ncave,

I made a new Fable release with all the changes available on main.

However, to do the release I had to revert Run husky with --allow-roll-forward because I had an error telling me that --allow-roll-forward is not a recognised argument.

I didn't investigate any further as I wanted to make the release and we can re-introduce --allow-roll-forward if needed.

ncave commented 1 week ago

@MangelMaxime

I had to revert https://github.com/fable-compiler/Fable/pull/3956

That's fine, we can add it later. Just need to figure out how to conditionally add it only for .NET 9.0.

ncave commented 1 week ago

@MangelMaxime Rebased, ready for review.

Let me know if you think we need to bump the Fable CLI major version for this change in TFM.

MangelMaxime commented 1 week ago

@ncave Thank you, I will have a look at it tomorrow.

MangelMaxime commented 6 days ago

I think this is ready to be merge but we need to make a decision regarding the version number indeed.

I believe we should probably bump the major version because people requesting .NET 6 using global.json will not be able to use Fable 5. At least, that's what I would expect dotnet/NuGet to do.

If we do the bump, here are the "side effects" we should resolve (perhaps there are some others too):

  1. Can this cause issues with Fable compiler plugins?

    In theory, this should be fine because Compiler plugins should have defined something like override _.FableMinimumVersion = "4.0"

    Example with Feliz

    There are probably only 2 plugin really impact by that Feliz which should be ok and Oxpecker.Solid which should also be fine.

  2. What about Fable.AST ?

    I think I remember a discussion where we mentioned that Fable AST version was mirroring Fable version. So Fable AST 4.x was for Fable 4.

    Should we also bump Fable.AST to version 5 or says that Fable.AST 4 is compatible with Fable 4 & 5?

    I think the easier path is to consider Fable.AST 4 compatible with Fable 4 & 5. We can even make a matrix in Fable documentation to make an official statement.

  3. If we bump to .NET 8, it means we are now in a situation where we can make MSBuildCrackerResolver the default instead of BuildalyzerCrackerResolver.

    If we do the major bump, I think this a good opportunity to do the switch and add a --legacy-resolver options to Fable CLI as a potential workaround if something was not catch during the experimentation phase of MSBuildCrackerResolver.

  4. We need to archive current Fable REPL under /repl4 and make the /repl target Fable 5.

  5. We need to create FABLE_COMPILER_5 compiler directive. There is a risk that some libraries will need to be updated if they used #if FABLE_COMPILER_4 but I expect this impact to be minimal.

  6. I checked SAFE Stack template and they are already using .NET 8 via global.json. So at least, here we should avoid too much migration path issues if we bump to a .NET 8 tool.

With all that said I see 2 solutions:

  1. We keep release F# 9 support in Fable 4 targeting .NET 6, which will give us time to think about the issues mentioned above. We can
  2. We go with Fable 5 and decide now what happens in regards of the different impacted areas.
ncave commented 6 days ago

@MangelMaxime All good points, I fully agree (especially # 3, I was going to say the same exact thing). IMO, let's just go with it, the nullability change in F# 9 is reason enough to bump major version in Fable too.

nojaf commented 6 days ago

My two cents: go with a major and publish alpha's until you get it right.

MangelMaxime commented 6 days ago

You are right @nojaf better be safe than sorry.

@ncave Unless, you started working on the different items I listed, I can work on them and if all goes well make an alpha version to check it on a "real project".

ncave commented 6 days ago

@MangelMaxime Please go ahead. IMO # 4 (the repl update) can wait until #3960 is merged.

MangelMaxime commented 4 days ago

@ncave Fable 5.0.0-alpha.1 has been released.

I made the main branch for Fable 5 release and created a fable4 branch if we need to make a release for this version.

I did it in this order because, I don't see Fable 5 to stay in alpha for a long time and like that we can focus on a single version instead of maintaining 2 versions at the same time. If needed, we can always revisit this position.