<p>Am 31.12.2016 16:28 schrieb "Bart" <<a href="mailto:bartjunk64@gmail.com">bartjunk64@gmail.com</a>>:<br>
><br>
> Hi,<br>
><br>
> Why is it that type helpers must be declared in the Interface section<br>
> of a unit and cannot be private in Implementation section?<br>
><br>
> Consider this (useless) example:<br>
><br>
> unit thtest;<br>
><br>
> {$mode objfpc}{$H+}<br>
> {$modeswitch typehelpers}<br>
><br>
> interface<br>
><br>
> type<br>
>   TSomeType = record end;<br>
>   TA = Array of TSomeType;<br>
><br>
>   { TAHelper }<br>
><br>
>   TAHelper = type helper for TA<br>
>     constructor Create(A: TA);<br>
>     procedure DoIt;<br>
>   end;<br>
><br>
> procedure X;<br>
><br>
> implementation<br>
><br>
> procedure X;<br>
> var<br>
>   A: TA;<br>
> begin<br>
>   A.DoIt;<br>
> end;<br>
><br>
> { TAHelper }<br>
><br>
> constructor TAHelper.Create(A: TA);<br>
> begin<br>
>   Self := A;<br>
> end;<br>
><br>
> procedure TAHelper.DoIt;<br>
> begin<br>
>   ;<br>
> end;<br>
><br>
> end.<br>
><br>
> This compiles fine.<br>
> But when you move the declaration of TAHelper to the implementation<br>
> section, then you get a compiler error:<br>
><br>
> thtest.pp(21,5) Fatal: Syntax error, "CREATE" expected but "DOIT" found<br>
> Line 21 is<br>
>   A.DoIt;<br>
><br>
> I'm using fpc 3.0.0 (32-bit) on Windows.</p>
<p>You did put the helper declaration before the implementation of X, right?</p>
<p>If you still have a problem, please open a bug report with an example (cause that should definitely work).</p>
<p>Regards,<br>
Sven</p>