> On Sep 4, 2018, at 7:15 PM, Sven Barth via fpc-pascal 
> <fpc-pascal@lists.freepascal.org> wrote:
> 
> Would you please stop thinking with the C operators? They are merely 
> syntactic sugar and they don't exist by themselves. For this topic at least 
> please stick to their full versions (in your example "rec := rec + 10") as 
> that highlights better what the compiler needs to handle. In this case both 
> the + *and* the assignment operator. 
> 

Sorry, please bear with me.

I think this is just a precedence issue I raised. If TWrapper has a + operator 
then:

wrapper := wrapper + 1

should call the + operator, because base class takes precedence over the field 
num: integer. Correct? If TWrapper doesn’t have a + operator then:

wrapper := wrapper + 1 should resolve to wrapper.num := wrapper.num + 1

right?

type
        TWrapper = record
                num: integer;
                property _default: integer read num write num; default;
                class operator + (left: TWrapper; right: integer): TWrapper;
        end;

Regards,
        Ryan Joseph

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

Reply via email to