[fpc-pascal] Traits Proposal

Sven Barth pascaldragon at googlemail.com
Mon Feb 22 11:16:13 CET 2021


Ryan Joseph via fpc-pascal <fpc-pascal at lists.freepascal.org> schrieb am
Mo., 22. Feb. 2021, 10:07:

>
>
> > On Feb 19, 2021, at 8:50 AM, Ryan Joseph <genericptr at gmail.com> wrote:
> >
> > I just realized another potential problem. If we use the "default"
> keyword that means there could be multiple "defaults" unless we limit the
> property to 1 per class, which would kind of defeat the purpose of the
> feature (like the issue we had with helpers and made multi-helpers for).
>
> Can you respond to this concern? It could be a deal breaker for the syntax.
>

It depends on how "default" is defined. If we define it as "moves the
interface into the class' namespace" there is no problem as long as there
are no other conflicts (e.g. two interfaces with a Draw method without
further parameters that should still be handled by two different delegates
=> simply not possible).

I *think* Delphi allows multiple default array properties as long as they
have different index types (e.g. String vs Integer), though I'd need to
test this.

But independent of that I wouldn't have a problem to define "default" for a
delegation property in the way mentioned above.

Regards,
Sven

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20210222/e78a4ae6/attachment-0001.htm>


More information about the fpc-pascal mailing list