I know this is going to get eyeballs rolling given everything else going on.
But using grasshopper is very much like functional programming isn’t it. I don’t know if any of you have used F# but, well it’s pretty damned good and it’s a more natural segue into coding proper from grasshopper given the functional programming bent.
I just thought, well there are already scripting editors for C# and ironpython in gh, it surely can’t be a biggie adding another for F#, could it? I mean it’s dot net after all. Hey, add VB whilst you’re in there too!
Just an idea. Don’t shoot me.
I bet David Rutten will be cursing me for suggesting this
I hadn’t thought about support impact, it’s good point.
I’m just trying to turn designers into coders and thought F# might be a better way for them. Designers don’t seen to like brackets and colons and I’m trying to keep them away from weakly typed Python as I don’t want to spend my days debugging runtime errors in their code.
If the new code editor for Rhino7/GH2 supports F# syntax then I think it makes a lot of sense to just add it, it’s better to have something with no official support than not have it at all.
Hi Cottonbale,
Yes i have a proof of concept for an FSharp scripting editor in Rhino.
Let me know if you want to test it or even contribut. It uses avalonedit. So it only works on windows.
Here a preview
my work in progress F# editor can be tested from here: https://1drv.ms/u/s!Atin9rLFR_7RlaVI3CH_4qc_Fi7aNw?e=UskanF
there is also a port of rhinoscriptsyntax to F#.
Documentation is still missing.
let me know if you have bugs. Note that fsi runs async. So for UI interaction you need to switch to UI thread:
async{
do! Async.SwitchToContext Rhino.Scripting.Synchronisation.syncContext
// you UI code goes here
} |> Async.RunSynchronously
or use any of the Rhino.Scripting.Rhinoscriptsyntax function that does this automatically. like rs.GetObject("msg")