[SOLVED] object pascal handbook and generic lazarus / 62-General ---------------------------------------------------------------------- superc · 2022-02-18 09:58 Hello, I'm downloaded a Marco Cantù book : 'Object Pascal Handbook': I'm trying code like: 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 typeTKeyValue = class  private    FKey: string;      FValue: T;    procedure SetKey(const Value: string);    procedure SetValue(const Value: T);  public    property Key: string read FKey write SetKey;    property Value: T read FValue write SetValue;end;  In lazarus this code doesn't work, ok but.... Why book is named Object Pascal Handbook?? Thanks in advance. ---------------------------------------------------------------------- zeljko · 2022-02-18 10:15 If you're in {$mode objfpc} then add generic before TKeyValue, or set {$mode delphi} and it'll work .... https://wiki.freepascal.org/Generics ---------------------------------------------------------------------- Thaddy · 2022-02-18 10:35 IOW use {$mode delphi} ---------------------------------------------------------------------- Warfley · 2022-02-18 10:37 This is a bit confusing, but there is no one Object Pascal language. There are different dialects under the broad term Object Pascal. I don't know the Object Pascal landscape fully, but Turbo Pascal, Delphi and FreePascal are three different dialects of Object Pascal, and do things differently. Generics is just one of the examples. Another one is Management Operators, Operator Overloading, or simply that in FreePascal you take function pointer with @ while in Delphi no Operator is needed. These are just things one has to learn. ---------------------------------------------------------------------- Thaddy · 2022-02-18 10:43 Quote from: Warfley on February 18, 2022, 11:37:54 am but Turbo Pascal, Delphi and FreePascal are three different dialects of Object Pascal, and do things differently. Well, at the minimum, FPC tries to achieve all reasonable modes..... FPC has many dialects.. And that code simply compiles in {$mode delphi} Some code - in fpc -does not compile until anonymous methods do work, but Marco's book is otherwise excellent. ---------------------------------------------------------------------- superc · 2022-02-18 10:53 I read from from https://wiki.freepascal.org/Generics QuoteIt is possible to use units written in {$mode ObjFPC} syntax in other units that use {$mode Delphi}, and vice versa. so I deduce that I can use one mode in some units and the other in others, not as bad as i thought..... ---------------------------------------------------------------------- Thaddy · 2022-02-18 16:00 Correct.