Am 17.01.2019 um 13:17 schrieb Mattias Gaertner via fpc-pascal:
Hi,

For example:
type
   THelper = type helper for string
     function GetItems(Index: word): word;
     property Items[Index: word]: word read GetItems; default;
   end;

Delphi forbids this with "'default' directive not allowed in record
helper type".
FPC ignores it. Aka aString[1] has still the normal meaning.

Same for arrays, double, integers.

Is this an oversight, or has FPC some use for the default directive?
For now I'd say that it's an oversight. Delphi allows it for class and record helpers, but not for helpers for primitive types. In theory we could allow it for non-array and non-string types (aka those that don't have an internal [...] "operator"). On the other hand we can simply forbid "default" for primitive type helpers like Delphi does...

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to