4 ms·
In F# scripts you can add dependencies directly from Nuget like so: #r "nuget: NodaTime, 3.2.1" open NodaTime let now = SystemClock.Instance.GetC
by greener_grass 2y ago
In F# scripts you can add dependencies directly from Nuget like so:
#r "nuget: NodaTime, 3.2.1"
open NodaTime
let now = SystemClock.Instance.GetCurrentInstant()
printfn "%A" now
- neonsunset 2y agoOne of the best features. Just import everything! Nuget packages, local dlls, other F# script files, you name it. It's so good. No extra ceremony. And when you open it in VS Code with Ionide - you get full support of the language server, documentation and syntax highlighting to know that your script is correct. Night and day difference with standard scripting languages.
- greener_grass 2y ago> other F# script files This is where it breaks down a bit. Importing the same script file twice leads to errors, so you must manually ensure exactly once imports across your dependency tree of scripts. This is where C/C++ code reaches for include guards, but F# does not have a define pre-processor command (unlike C#).
- neonsunset 2y agoFair. I think if this issue takes place - it's probably time to switch from script files to a full .NET project. Or package a distinct piece of functionality as such.
- greener_grass 2y agoThere's no good reason FSI can't be improved to handle this though
- neonsunset 2y agoIf you're interested, you could further raise this on F# discord server or in https://github.com/dotnet/fsharp https://github.com/dotnet/fsharp, F# is effectively a community-managed language so if there's a particular change you'd like to see, there is a high chance you can just make it happen if you have time to see it through.