Hi Maurits,

F# does have a yeild statement, but only in seqence blocks. Here is more details on how this works in this post from Don Syme: [link:blogs.msdn.com]

However in your case don't you just want to return the new procedure object wrapped in a list? I haven't test this, as I don't have gimp# on this box, but it should look something like:

1
2
3
4
override x.ListProcedures() : seq =
  let procedure = new Procedure()
  procedure.MenuPath <- "<Image>/Filters/Generic"
  [ procedure ] :> seq

Thanks,
Rob

By on 12/3/2007 5:32 AM ()

Hi Robert,

Thanks for your reply! This is probably exactly what I'm looking for. I will try it this evening as soon as I get home. Hopefully I will then have the very first GIMP# plug-in written in F# :)

I'm not very familiar with F# syntax yet but from what I've seen and read sofar it looks like a great language. I'm really looking forward to learning more. As far as GIMP# is concerned, I now have quite a few .NET languages running on top of my .NET assembly (which is basically a wrapper around the GIMP lib). There are sample plug-ins written in C#, Java (using IKVM), Python (via IronPython), Boo, Nemerle, VisualBasic.NET and pretty soon F#.

Most implementations have a similar performance for the sample plug-in I use. This plug-in just takes the average color of all pixels in an image, and sets all pixels of that image to this color. Only exception is IronPython which is about 4 times slower than the other languages. Of course this is only a micro benchmark without much real world value. I'm very curious though about how well F# will perform.

By on 12/3/2007 5:55 AM ()

Hi Maurits,

Great! Please post some screen shots after you're done.

If you have any perf issues ask here on hubFS and we should be able to get them sorted out. We'd expect equivalent perf to C# here, though the code may need to be adjusted slightly to get that.

Cheers

don

By on 12/3/2007 8:49 AM ()

Hi Don,

Thanks to Roberts tip I managed to complete the first F# plug-in for GIMP#. The performance for this very simple testcase is very close to C#: less than 5 % slower. I suspect however that most of the work in this plug-in is done in actually iterating through the pixels in an image. This is part of my GIMP# framework and all written in C#. For each pixel a delegate is called which can be in any language (Nemerle, F#, Boo, VisualBasic, IronPython). Since this is such a trivial plug-in the calculation in the delegate is very fast and only a small percentage of the overall calculation. I'll try to be more specific later.

As far as the screen shots are concerned: this plug-in doesn't have a GUI. So there's not much to show.

By on 12/3/2007 12:29 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper