Replies: 4 comments 2 replies
-
We would, because F# REPL is still a thing. I don't think we can just ignore "file-based", we should try to align to the UX that is brought to C# file-based app; but IMO we don't have to remove anything from script or REPL workflows. |
Beta Was this translation helpful? Give feedback.
-
|
We should also be aware that the C# file-based apps need a lot of dedicated work to make them work in various tooling, the SDK CLI is just the starting point. Running, debugging, highlighting such programs is still a concern and from the perspective of interactive users, something which .fsx already has. My recommended direction of focus would be to find a reasonably defined subset of .fsx files that could be supported by |
Beta Was this translation helpful? Give feedback.
-
|
Are you interested into the topic of file-based apps for F#? This is a complement to the asynchronous suggestion/discussion process we have in this thread, and we would love any ideas or input you might have on the topic. The session will be recorded and offline discussion is encouraged to continue here in the repo 👍as well . |
Beta Was this translation helpful? Give feedback.
-
|
Here is the recording of the above mentioned meeting. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Background
.NET 10 will support "file based apps" for C#. This means that you can run a source file
app.csbydotnet run app.cswithout the need to create a project file or to deal with artifacts. The source file can contain directives for referencing packages or adding build properties. When the need arises you can automatically create a whole conventional project from it bydotnet project convert.So, this is a nice way to create small tools, and certainly a good way to introduce newcomers to the language.
The
runfsproject demonstrates similar functionality for F#.But we have file-based apps already in F#
F# always had something similar, namely scripts. You can run scripts by
dotnet fsi app.fsx. And scripts can also contain directives to reference packages. So, we could close the discussion here and be content.Or have we?
If F# scripts did not exist, we would today not invent F# scripts, but F# file-based apps. There are a number of advantages that file-based apps (the way C# has them now and
runfsdemonstrates for F#) have over F# scripts.One limitation of F# scripts is that they don't accept the full F# grammar, but only a limited subset, without namespaces and top-level modules. This is a severe nuisance in going from scripts to projects and vice versa and cannot easily be automated.
Also, the script directives for package references are dependent on the package manager and even for nuget have subtle differences to
PackageReferencein project files.Furthermore, since scripts are executed by the huge and legacy-loaded
fsitool, it is not easy to introduce new features such as caching the compiled script, adding msbuild properties, referencing sdks.Finally, the need to understand the difference between
.fsand.fsxfiles is an unnecessary burden for newcomers.See also this table.
Our options
Stick to what we have.
Ignore file-based apps, keep using scripts. Try to backport some of the new goodies (conversion tool, caching) to fsi.
Embrace file-based apps as "F# scripts next generation". Migrate from scripts to using
dotnet run app.fs(or, as long as that does not yet exist,dotnet runfs app.fs).What is your view?
Beta Was this translation helpful? Give feedback.
All reactions