[fpc-pascal] with in classes/records

Ryan Joseph ryan at thealchemistguild.com
Tue Sep 4 09:06:10 CEST 2018



> On Sep 4, 2018, at 1:57 PM, Ryan Joseph <ryan at thealchemistguild.com> wrote:
> 
> // what happens here? is this a wrong type error (TObject is expected but got TWrapper) or do we assign directly to the base record? I can see it both ways so I’m not sure what principle to fall back on. Allow it because we can or prevent it because it’s not intended functionality?
> wrapper := other;

Sorry I didn’t think enough before I sent this.

We *must* allow this assignment to make operator overloads work. +=  operators are also basically assigning TWrapper to TWrapper, right? I guess we need to break the default property behavior is instances that the same type is being assigned to itself but correct me if I’m wrong.

var
	wrapper: TWrapper;

wrapper += 10;

Regards,
	Ryan Joseph




More information about the fpc-pascal mailing list