[fpc-devel] class abstract, class sealed implementation. please review.

Paul Ishenin webpirat at mail.ru
Sat Oct 17 08:22:17 CEST 2009


Alexander Klenin wrote:
> 2) parse_object_options consumes exactly one exemplar of either
> "abstract" or "sealed".
>   actually, Delphi allows arbitrary number of these keywords (e.g.
> "class abstract abstract").
>   This is pointless, but I think should be allowed for compatibility,
> perhaps with a warning.
>   
Done with no warning/hints. I decided not to show warning since fpc 
allows to declare methods with many 'abstract'.
>   Also, this code would be hard to extend in case some more options are needed.
>   I would suggest to trite it as a loop adding all options,
>   and then after the loop check for conflicts:
>      if [oo_is_abstract, oo_is_sealed] *
> current_objectdef.objectoptions =  [oo_is_abstract, oo_is_sealed] then
> error;
>   
Ok.
>   Finally, I think the function should be named parse_class_options.
>   
no, later it could be used for another types of objects.
> 3) This patch introduces new keyword -- what about backwards
> compatibility? The code like:
>   type T = class sealed: Boolean; end;
> will stop compiling after the patch. Maybe it is better to use another syntax?
>   
Same with any other keywords. If we want to compile delphi projects then 
we need to support delphi syntax.
> Besides, I have some comments on the feature itself.
>   
Feature was made to support delphi syntax and it do this in almost 100% 
compatible way. If there are some problems with this then I can modify 
the patch to allow this only in delphi mode.

Best regards,
Paul Ishenin.



More information about the fpc-devel mailing list