Michael Van Canneyt wrote:
On Sat, 23 Jun 2007, Joao Morais wrote:Hello, Taking the following code: {$mode objfpc}{$h+} class function tfoo.classmetadata: string; var vmetadatamethod: function: string of object; begin vmetadatamethod := @internalmetadatastr; // more code Result := vmetadatamethod; end; the last assignment doesn't compile, the compiler complains that: Error: Incompatible types: got "<procedure variable type of function:AnsiString of object;Register>" expected "AnsiString"Try Result := vmetadatamethod();
Nice idea, now it works. =) Thanks.
Strange code you have,
An useful abstraction to ensure that an specific class implements an specific virtual method. If it doesn't implement, I need an empty string instead of the inherited value.
Your code does not even compile under Delphi...
It compiles and works since (at least) D5 and under fpc's $mode delphi. In this case, the need of the brackets under objfpc can be considered a bug? Should I file a bug report?
-- Joao Morais _______________________________________________ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
