On 08.01.2017 11:36, Ryan Joseph wrote: > >> On Jan 8, 2017, at 5:22 PM, Sven Barth <pascaldra...@googlemail.com> wrote: >> >> 1. Why are you trying to assign something to io when you already did >> that with "obj := …"? > > I used absolute here so I could know the type of io and not type cast within > the function. No good? The idea is I want “io” to be assigned with the value > from newObject or set to nil if the input is nil. I know io is a member of > TObject but I don’t want type checking when I return the value from the > function otherwise all my calls look like RetainObject(TObject(foo), newFoo). > It’s a small annoyance but I thought I would take the time to learn Free > Pascal more since it always pays off in the end.
The use of absolute is absolutely (ha!) fine. However the second assignment using "io" is superfluous as you already did the assignment through the absolute alias. Regards, Sven _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal