[fpc-pascal] Operator overload resolution with arrays
Maciej Izak
hnb.code at gmail.com
Mon Feb 5 21:02:27 CET 2018
2018-02-05 19:54 GMT+01:00 Sven Barth via fpc-pascal <
fpc-pascal at lists.freepascal.org>:
> Now I see why it is how it is.
>
> The maximum extent would be to accept overloads (and helpers) that are
> visible
> at the parameter type's declaration, because they would necessarily be
> visible
> in all specializations as well. That would be pretty much the same as how
> it
> currently accepts operators defined on the type, just one symtable up. It
> would
> also solve the "implementation restriction" from the manual - and only
> that. I
> think?
>
>
> That *could* be a possibility. I'd need to think about it a bit though to
> be sure that there are no caveats.
>
It may be good feature or more troubles ;) The only acceptable types where
"one symtable up" should be used, are types with own RTTI info:
type
MyInteger = type Integer;
{ .. some operators for MyInteger ... }
TMyHelper = type helper for MyInteger
{ something }
end;
type alias declaration for our case is not an option:
type
MyInteger = Integer;
{ .. some operators for MyInteger ... }
TMyHelper = type helper for MyInteger
{ something }
end;
for such case TMyHelper (or operator) should be invisible in
specializations, otherwise compiled program will explode :P.
--
Best regards,
Maciej Izak
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20180205/95bd74ea/attachment.html>
More information about the fpc-pascal
mailing list