On 5/16/2014 11:18 AM, Florian Klämpfl wrote:
> Isn't using anonymous methods in this case only a work around for missing 
> OpenMP support?

Absolutely, but neither Free Pascal nor Delphi implement OpenMP.  The
OpenMP page on the Free Pascal wiki hasn't been significantly changed
since 2008, which coincidentally is the last time Allen Bauer blogged
about his "Delphi Parallel Library".  I'm looking for something that I
can use soon, not in 5 years.

Also, while I prefer the OpenMP proposals in the wiki, I don't see us
dropping Delphi for Lazarus on Windows anytime soon.  Short term we'll
be too busy moving our Linux version over from Kylix and then re-porting
our OS X version from LCL/Carbon to LCL/Cocoa.

> I still don't get how closures/anonymous methods help you to get rid of 
> fibers? I mean, anonymous
> methods are only a short cut; closures allow you to capture the state of the 
> variables of the outer
> scope even if the outer scope is left. But that's it?

No, it doesn't completely replace fibers.  That will require some very
painful detangling and much uglier, asynchronous code.  However, a
majority of the usage is just doing calculations, showing a dialog, then
doing something with the dialog results.  In cases like that it should
be relatively easy to do fairly mechanical conversions to something
based on anonymous methods and closures.

I'm not sure what you mean by the "But that's it?" though.  Yes, they're
just syntax sugar.  The alternative is creating a second procedure
(polluting the namespace), declaring, allocating, and initializing a
record with the local state, then passing it to that second function.
It's doable, and that's exactly what we did before I implemented the
fiber support, but it's certainly not ideal.

-- 
Craig Peterson
Scooter Software

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to