[fpc-devel] Allow record helper inheritance in Delphi mode

Sven Barth pascaldragon at googlemail.com
Thu Sep 14 07:57:23 CEST 2017


Am 13.09.2017 22:21 schrieb "Ondrej Pokorny" <lazarus at kluug.net>:
>
> On 13.09.2017 22:08, Sven Barth via fpc-devel wrote:
>>
>> Anyway, I had looked at your patch last Friday, but after some thinking
>> I came to the conclusion that I definitely don't want the typehelpers
>> modeswitch to enable inheritance on record helpers in mode Delphi cause
>> that would be some unexpected sideeffect on that switch. However to
>> implement this correctly I'll need to store the helper type in the PPU.
>> It's nothing big, just something I need to find the time for...
>
>
> Great. Thanks for the feedback. I appreciate it.

As you might have seen I have now added the part about storing the helper
type, so I can now adjust your patch for the final inclusion (either today
or tomorrow if all goes well).

>>> Btw. when you are so strict about disabling helper inheritance due to
>>> Delphi compatibility why do you allow C-like operators in Delphi mode by
>>> default?
>>>
>>> program Cop;
>>>
>>> {$mode delphi}
>>>
>>> var
>>>    I: Integer;
>>> begin
>>>    I := 0;
>>>    I += 1;
>>> end.
>>>
>>> ... and they even have their COPERATORS directive.
>>
>> Two things:
>> 1. If you compile with -n (and -Fupath/to/rtl) you'll see that it is not
>> Delphi mode that enables the C-operators, but the default fpc.cfg (and
>> no, I don't know who had the idea to enable that as default; maybe it
>> was originally default and then moved to a directive, but kept set by
>> default using the fpc.cfg... - for this however see the next point)
>
>
> This is what I thought as well. I took a look into my fpc.cfg and saw -Sc
is commented out:
>
> #      -Sc        supports operators like C (*=,+=,/= and -=)
>
> But I didn't look at the end of the section where it is defined:
> -Sgic
>
> My apologies :) But there are still inconsistences that just feel strange
:/
>

As said FPC has quite a history baggage to carry and the stances on the
modes have only changed relatively recently (e.g. the ISO mode doesn't
allow you to use units as they weren't defined there, so in that sense the
mode is extremely strict).

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20170914/1fe1b38b/attachment.html>


More information about the fpc-devel mailing list