Sintax error about generics in manual lazarus / 61-Beginners ---------------------------------------------------------------------- simone · 2016-07-07 21:45 Maybe I did not understand some advanced topics about syntax of the classes and generics (I'm an old turbo pascal programmer, new to FreePascal), but it seems to me that the following the example of the manual, has a wrong syntax: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Type    generic TList<_T>=class(TObject)      type public         TCompareFunc = function(const Item1, Item2: _T): Integer;      var public        data : _T;      procedure Add(item: _T);      procedure Sort(compare: TCompareFunc);    end;  (from http://www.freepascal.org/docs-html/current/ref/refse49.html ) I think it should be: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Type    generic TList<_T>=class(TObject)      public      type         TCompareFunc = function(const Item1, Item2: _T): Integer;      var     data : _T;      procedure Add(item: _T);      procedure Sort(compare: TCompareFunc);    end; Someone can confirm that? ---------------------------------------------------------------------- molly · 2016-07-08 00:44 I can at least confirm that i was unable to let fpc 3.0.0 compile that example from the documentation for me. Perhaps i missed a switch somewhere. i think your correction is required. ---------------------------------------------------------------------- simone · 2016-07-08 06:56 With my correction in the code, fpc 3.0.0 compiles without errors... ---------------------------------------------------------------------- Cyrax · 2016-07-08 07:53 Please file a report in the bugtracker so it won't be forgotten and will be fixed in the next release. ---------------------------------------------------------------------- Leledumbo · 2016-07-08 09:09 The documentation seems to come with the early generics syntax implementation. At that time, the code compiles. There was even a time where you can freely switch visibility specifier and type (and var and const). I think they're now "fixed" by forcing visibility specifier before any block marker. So yeah, report it. ---------------------------------------------------------------------- simone · 2016-07-08 17:05 Thank you. I wrote a report in the bugtracker.