As I see if we could use with like below, adding a dot before
property/function/procedure
with Canvas do
begin
.Rectangle(0, 0, .Width, .Height);
end;
2011/8/5 Alexander Klenin <[email protected]>
> On Fri, Aug 5, 2011 at 22:04, Luca Olivetti <[email protected]> wrote:
> >> Unfortunately, "with a = b do" is already a valid operator in FPC,
> >> with different meaning.
> >
> > What does it mean?
> >
> > I tried
> >
> > procedure Test;
> > type tr = record
> > f1,f2:integer;
> > end;
> > var r:tr;
> > begin
> > with a=r do;
> > end;
> >
> > and trying to compile it
> > "Error: Operator is not overloaded"
> > "Error: Expression type must be class or record type"
> >
> > Same error even if I define a:tr.
>
> I thought that you could overload opertator =:
>
> type T = record x, y: Integer; end;
> operator =(A, B: T): T; begin Result := a; end;
> var a, b: T;
> begin
> with a = b do Writeln(x);
> end.
>
> However, FPC forbids overloading of "=" with non-Boolean result,
> so it turns out you are right, "=" token is available.
>
> --
> Alexander S. Klenin
>
> --
> _______________________________________________
> Lazarus mailing list
> [email protected]
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus