[fpc-pascal] Interface syntax: Is possible don't use specialize in mode objfpc?

Marcos Douglas md at delfire.net
Thu Jul 16 18:02:51 CEST 2015


On Thu, Jul 16, 2015 at 11:44 AM, Michael Van Canneyt
<michael at freepascal.org> wrote:
>
>
> On Thu, 16 Jul 2015, Maciej Izak wrote:
>
>> sadly - no, only in Delphi mode. btw. this thing keep me away from objfpc.
>
>
> That seems like a very strange reason to me.
>
> The fact that you must type 1 word in certain places keeps you from using an
> otherwise useful mode ?
> This word is there for clarity, It is meant to help you, to make explicit
> you are in fact specializing a new type.

Yes, but do you think this is more verbose unnecessarily? Because the
syntax TFoo<T> (I mean this "<>") show us that is a generic, don't?

The Lazarus also has some troubles with the code completion using this:
TFoo = class(TInterfacedObject, specialize ICloneable<TFoo>)

Sometimes the IDE shows an error in interface declaration, but compiles.
So, to not receive these errors I have to create a new type:

TFoo = class; //forward

IFooCloneable = specialize ICloneable<TFoo>;

TFoo = class(TInterfacedObject, IFooCloneable)
//...
end;
...making even more verbose.


Regards,
Marcos Douglas



More information about the fpc-pascal mailing list