F#. Oh you know you want to


(Cottonbale) #1

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! :grin:

Just an idea. Don’t shoot me.

I bet David Rutten will be cursing me for suggesting this :smirk:


(Nathan 'jesterKing' Letwory) #2

Dunno about scripting editors - but there is nothing that should hold you back from using F#.

Here an old minimal example of a F# plug-in that provides one component:

And here the original GhShaderNodes plug-in for Grasshopper:

Since then rewritten in C#, but I like the F# code more for this plug-in. Very clean and terse.


(Michael Pryor) #3

add VB whilst you’re in there too!

There is a VB component / editor already. Right next to the C# and python ones.


(David Rutten) #4

Some users have been using their own F# editor, but I don’t think it was made publicly available (could be wrong about that).

I have no problems at all supporting more languages, however very few people at McNeel know F# so day-to-day tech support would be a stretch.


(Cottonbale) #5

Of course there is, my mistake


(Cottonbale) #6

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.

It was just a thought.


(David Rutten) #7

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.


(Cottonbale) #8

Oh I didn’t know it was in v7, I’m still on 6.


(jesterKing) #9

There is an F# editor for Rhino, you could ask @Goswin

Rhino WIP on Windows is v7 to be.


(Cottonbale) #10

Yeah I know WIP is the next iteration in beta, just haven’t downloaded it yet. Will chase Goswin on this, cheers!


(Cottonbale) #11

Btw, before I get flamed, I meant dynamically typed python not weakly typed python.


#12

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


#13

Autocomplete, type info, and error highlighting is working too for most cases.


#14

It can probably be embedded in a GH component too


(Cottonbale) #15

Awesome stuff!

I’ll have a go today, thanks Goswin!!


(Cottonbale) #16

Thanks for this Nathan!


#17

here is an F# template for a Rhino plugin https://github.com/goswinr/Rhino.FSharpPluginEmptyTemplate