[fpc-devel] Multiple Helpers for a type

Michael Ring mail at michael-ring.org
Sun Jul 12 12:09:49 CEST 2015


Please disregard last post, this demo actually works when I uncomment:

testlongWordHelper2 = record helper (testlongWordHelper1) for testlongWord

I will need to have another look if this example is too simple or I did 
something wrong in my 'real' code.

Michael

Am 12.07.15 um 11:55 schrieb Michael Ring:
> Here's a simplified example, it fails with a compiler error when 
> compiling it with trunk:
>
> test.pas(37,5) Error: Illegal qualifier
>
>
> program test;
> {$modeswitch objpas}
> {$modeswitch advancedrecords}
> {$modeswitch typehelpers}
> type
>   testlongWord = longWord;
> var
>   t : testlongWord;
> type
>   testlongWordHelper1 = record helper for testlongWord
>     procedure setValue1(a : longWord);
>     function getValue1 : longWord;
>     property Value1 : longWord read getValue1 write setValue1;
>   end;
>
> type
>   //testlongWordHelper2 = record helper (testlongWordHelper1) for 
> testlongWord
>   testlongWordHelper2 = record helper for testlongWord
>     procedure setValue2(a : longWord);
>     function getValue2 : longWord;
>     property Value2 : longWord read getValue2 write setValue2;
>   end;
>
> procedure testlongWordHelper1.setValue1(a : longWord);
> begin
> end;
> function testlongWordHelper1.getValue1 : longWord;
> begin
> end;
>
> procedure testlongWordHelper2.setValue2(a : longWord);
> begin
> end;
> function testlongWordHelper2.getValue2 : longWord;
> begin
> end;
>
> begin
>   t.Value1 := 10;
>   t.Value2 := 10;
> end.
>
> Am 09.07.15 um 17:17 schrieb Sven Barth:
>>
>> Am 09.07.2015 14:38 schrieb "Michael Ring" <mail at michael-ring.org>:
>> >
>> > I now exactly hit that issue, I have a set of 'basic' typehelpers 
>> that I wanted to extend in a second unit, but unfortunately this does 
>> not work, the newly defined type-helpers do not allow me to access the
>> > functions defined in the 'basic' typehelper, so this approach is 
>> not possible....
>> >
>>
>> Would you please show code? Because at least in mode ObjFPC that 
>> should work and if not it's a bug.
>>
>> >
>> > Are those future development plans already reality and I did simply 
>> miss the correct modeswitch or is this still on the ToDo List?
>> >
>> > If it's todo, are there already any plans on when this could get fixed?
>>
>> It's still on my ToDo list (the most complicated part being to define 
>> the order how methods are found). Currently I'm working on other 
>> topics though...
>>
>> Regards,
>> Sven
>>
>>
>>
>> _______________________________________________
>> fpc-devel maillist  -fpc-devel at lists.freepascal.org
>> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>
>
>
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20150712/578164e6/attachment.html>


More information about the fpc-devel mailing list