picoe / Eto

Cross platform GUI framework for desktop and mobile applications in .NET
Other
3.69k stars 334 forks source link

F# scripting support #385

Open dsyme opened 9 years ago

dsyme commented 9 years ago

I see the F# support in version 2.1.0, that's great!

Just to add a request for clean F# scripting support. Last time I checked (last year), Eto was quite hard to use in a cross-platform way from F# Interactive on Mac, Linux and Windows. I did manage to get something working in this example. The user code to reference Eto from an F# script looks like this:

#load "load-eto-winforms.fsx"  // <------ USE THIS ON WINDOWS 
//#load "load-eto-gtk.fsx"         // <------ USE THIS ON MAC 

In turn this loads this script or this script.

First, with the Windows and the GTK script come with a bunch of hacks and fixes (more so for GTK). Second, what we'd really like is for Eto to come with a single .fsx "loader script" that just works seamlessly.

If someone from Eto or the F# community can add this support to Eto and make some cross-platform tests, that would be fantastic.

cwensley commented 9 years ago

Question: what's the best way to distribute these fsx files? Is there a global repo available ala nuget, or just provide a link from the release page? I haven't looked into creating one yet, just curious.. I haven't used F# from a scripting environment yet, so I'm unfamiliar with how this is all put together.

Thanks for the feedback! Curtis.

smoothdeveloper commented 7 years ago

@cwensley / @dsyme, this is actually not needed, paket does generate those files automatically from nuget packages via a command line (paket generate-include-scripts).

I'm using Eto successfully from F# Interactive, both winforms and wpf but I'm confident the other target work the same (since Eto does such a great job with the nuget packages and platform support).

We should consider what we can do to advertise Eto and F# scripting, it is nice & easy to play with the library and F# is very clean to use (both in project or script).

I could add a wiki pages, and show usage on the main readme.md (it will take less space than the C# one so if you don't mind, I can add equivalent sample bellow), it would be easier to adapt from existing samples.

cwensley commented 7 years ago

@smoothdeveloper, thanks for the feedback! I'm really not familiar with F# tooling so it's good to hear you are getting some success.

I would certainly welcome wiki pages targeting F# users, and I think it'd be great to have an F# example on readme.md.

smoothdeveloper commented 7 years ago

@dsyme, @cwensley just merged (was so quick!) my PR which shows a small F# script on the front page.

For now the xplat story will rely on user referencing the specific packages, but with paket it is not too much trouble.

Until https://github.com/Microsoft/visualfsharp/issues/2453 fix is shipped on most platforms, I've made tutorial projects use a simple file copy, people can reference the core (platform agnostic) Eto.Forms assembly in their project and copy the platform runtime assemblies via msbuild or other mechanism.

For projects that need to access platform specific stuff, they anyway need to use compiler directive, I think this is true also for C# projects which aren't targetting desktop even today.

I wonder if you guys see other things we can address in short term to help promote / make more accessible the library to F# users?