On Sunday 30 December 2007 07:32:22 Micha Nelissen wrote: > bartek wrote: > > function HashOf(const Key: ShortString): DWord; > > > > function BucketNodeOf(const Hash: DWord): TBucket.PNode; > > DataContainers.pp(104,66) Fatal: Syntax error, ";" expected but "." found > > I'd say this is a bug, and your syntax is correct. Update the existing > bug report, perhaps? > > Micha > _______________________________________________ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal >
I am not quite sure whether my synatx is correct. IMHO explictly defining the type feels more pascalish. Having more time at hand i have written a much shorter example code which shows in what way such a type should be defined. Now I get: [1004] [EMAIL PROTECTED]:~/Dev/Tests % fpc test3.pp Free Pascal Compiler version 2.3.1 [2007/12/28] for i386 Copyright (c) 1993-2007 by Florian Klaempfl Target OS: Linux for i386 Compiling test3.pp test3.pp(18,32) Error: Error in type definition test3.pp(26,34) Error: Type "TPT" is not completely defined test3.pp(47,18) Error: Identifier not found "TPT" test3.pp(49,24) Error: Identifier not found "Data" test3.pp(54) Fatal: There were 4 errors compiling module, stopping Fatal: Compilation aborted Error: /usr/bin/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled) "Error in a type definition". I do not know whether fpc is supposed to support this kind if structures. If it is than it is a bug otherwise, no. Code: {$mode objfpc}{$h+} program test3; uses classes, sysutils; type generic TNode<T> = class type public PT = ^T; var private Data: T; public constructor Create; destructor Destroy; override; end; generic TContainer<T> = class type public TTNode = specialize TNode<T>; TPT = TTNode.PT; var private Data: TTNode; public constructor Create; destructor Destroy; override; function Get: TPT; end; constructor TNode.Create; begin end; destructor TNode.Destroy; begin inherited Destroy; end; constructor TContainer.Create; begin end; destructor TContainer.Destroy; begin inherited Destroy; end; function Get: TPT; begin result := @Data.Data; end; begin end. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal