[fpc-pascal] record helper types in 2.6

Bernd prof7bit at gmail.com
Thu Jun 28 15:11:15 CEST 2012


hello, I am referring to this: http://wiki.freepascal.org/Helper_types

I am using 2.6.1 from the fixes branch, last updated no longer than a week ago.

the wiki mentions this syntax:

TTestHelper = record helper for TTest
  procedure SomeMethod;
end;

Now I must be understanding something completely wrong or doing
something incredibly stupid but I can't find it, do I have to enable
some mode switch for record helpers to work or is there something else
that prevents my code from compiling? I am trying to do the following:



unit purple;

{$mode objfpc}{$H+}
{$if FPC_FULLVERSION < 20600}
  {$fatal *** You need Free Pascal Compiler version 2.6.0 or higher *** }
{$endif}

interface
uses
  Classes,
  ctypes,
  glib2;

type
  TGListHelper = record helper for TGList
    function Append(Item: Pointer): Pointer;
  end;

and it will generate the following error:
libpurple/purple.pas(77,32) Fatal: Syntax error, ":" expected but "FOR" found

I have stripped down the example to the bare minimum, so the line
numbers do not match but in the original file (77,32) points to the
"for" in the first line of the type declaration. What is wrong?

Bernd



More information about the fpc-pascal mailing list