[Lazarus] Annoying code completion failure

Sven Barth pascaldragon at googlemail.com
Sun Nov 3 23:31:33 CET 2019


Ondrej Pokorny via lazarus <lazarus at lists.lazarus-ide.org> schrieb am So.,
3. Nov. 2019, 23:15:

>
> On 03.11.2019 17:49, Sven Barth via lazarus wrote:
>
> Ondrej Pokorny via lazarus <lazarus at lists.lazarus-ide.org> schrieb am
> So., 3. Nov. 2019, 11:21:
>
>> On 02.11.2019 11:23, Michael Van Canneyt via lazarus wrote:
>> > TStrings has a property
>> >
>> >     property Values[const Name: string]: string read GetValue write
>> > SetValue;
>> >
>> > The setter is defined as:
>> >
>> > procedure SetValue(const Name, Value: string);
>> >
>> > Note that both arguments are 'const'
>> >
>> > When adding a new property, and pressing 'CTRL-C', the IDE adds the new
>> > property, but also insists on adding a new SetValue:
>> >
>> > procedure SetValue(const Name: string; AValue: string);
>> >
>> > Note the missing const on the second parameter.
>> >
>> > It does this of course not only for TStrings, but for all such
>> properties.
>>
>> The problem is not the const - Lazarus can ignore it. The problem is
>> that the parameters are joined - that is what Lazarus cannot handle.
>>
>> Replace
>>      procedure SetValue(const Name, Value: string);
>> with
>>      procedure SetValue(const Name: string; const Value: string);
>>
>> then Lazarus won't add it every time you do class completion. I know -
>> it's not what you currently have in the interface, but the difference is
>> just cosmetic. I usually let Lazarus do its job and don't care that the
>> parameters are separated.
>>
>
> This is not what one wants to hear.
>
> Well, I just explained the current state. It doesn't mean it cannot be
> improved.
>

Maybe Michael should file a bug report then... (and I should collect my
annoyances as well :P)

>
> Lazarus really likes to mess with existing code and it's one of the main
> reasons I'm *not* using class completion inside the compiler, cause
> otherwise I can be sure that the whole remaining class is changed as well
> -.-
>
> To be honest, the compiler code style is very quirky :)
>
> Ondrej
> --
> _______________________________________________
> lazarus mailing list
> lazarus at lists.lazarus-ide.org
> https://lists.lazarus-ide.org/listinfo/lazarus
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20191103/bf647884/attachment-0001.html>


More information about the lazarus mailing list