Forum > Free Pascal
Feature announcement: Function References and Anonymous Functions
edwinyzh:
Wonderful! Now all must-have syntax I want from FPC is available!
Thank all you guys!
avk:
This is really great news, many thanks to the FPC team!
Thaddy:
If you want to experiment, you need the latest trunk.
These defines can help others as well:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---{$ifdef windows}{$apptype console}{$endif}{$mode delphi}{$modeswitch functionreferences}{$modeswitch anonymousfunctions}{$warn 5036 off}// "Warning: (5036) Local variable "$Capturer" does not seem to be initialized" The "warn 5036 off" is just to suppress a warning about the $capturer variable:
I suppose that will be fixed later? It does not really harm, but I sometimes like to compile with -Sew.
Everything else looks OK, except some advanced examples that use extended RTTI, but that is logical and described in the announcement. It just means that some frameworks do not work yet.
I have by now tested some 20+ examples from Delphi that do work and some homebrew.
PascalDragon:
--- Quote from: Bi0T1N on May 27, 2022, 09:09:59 pm ---I think you can also close the issue now.
--- End quote ---
I wanted to look for that already. Thanks for finding it for me. :)
--- Quote from: Thaddy on May 27, 2022, 09:32:11 pm ---
--- Quote from: Bi0T1N on May 27, 2022, 09:09:59 pm ---I'm glad to see that it has finally arrived in FPC - good work! This should allow us to use several nice Delphi libraries with FPC. 8-)
I think you can also close the issue now.
--- End quote ---
Not only that: FPC can do more as per PascalDragon's introductary notes...
I have been toying with old D2009 and XE2 examples today and 90% can be made to work in minutes. Much more than I expected.
--- End quote ---
The other 10% would probably be interesting. At least if they don't rely on feature that we currently don't support (extended RTTI, some of the TValue functionality, etc.).
--- Quote from: Thaddy on May 28, 2022, 03:12:27 pm ---These defines can help others as well:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---{$ifdef windows}{$apptype console}{$endif}{$mode delphi}{$modeswitch functionreferences}{$modeswitch anonymousfunctions}{$warn 5036 off}// "Warning: (5036) Local variable "$Capturer" does not seem to be initialized" The "warn 5036 off" is just to suppress a warning about the $capturer variable:
I suppose that will be fixed later? It does not really harm, but I sometimes like to compile with -Sew.
--- End quote ---
And why, pray tell, did you not report this? This is the first time I hear of this considering that I wrote a ton of tests... :o Do you have an example where this happens?
Thaddy:
Of course, Sarah. See my above Barry Kelly example and comment the warn 8-)
But a great achiviement.
The warnings are on:
testanon.pas(51,1) Warning: (5036) Local variable "$Capturer" does not seem to be initialized
And on line 61 the same.
"$Capturer" is not accessible for the normal user.
There is also a note, but I tend to ignore those.
For completeness: "testanon.pas(60,3) Note: (5027) Local variable "x" is assigned but never used" which is not true...
Navigation
[0] Message Index
[#] Next page
[*] Previous page