> On Aug 18, 2018, at 11:04 AM, Ryan Joseph <r...@thealchemistguild.com> wrote: > >> The solution which probably should be accepted by fpc team is default >> property without indexer: >> >> === code begin === >> property obj: T read fobj; default; >> === code end === >> >> with this property should be possible: >> >> === code begin === >> Writeln(o.ToString); >> === code end === > > How does that property work exactly? Making this work properly is the most > important part but I never considered it. It sounds like “with” statements > kind of.
Ok, I understand what you mean now. This is actually a really great idea for all sorts of other uses because it helps to unify namespaces between classes and prevent long.and.annoying() chaining of fields. Btw why should this be a property? I know [] properties use the default keyword also but I don’t understand where this came from and it’s strange to name the [] property since the name is irrelevant. I would think you’d want to just put a modifier on the default field: TAutoCreate<T: class> = record _: T; default; class operator Initialize(var a: TAutoCreate<T>); class operator Finalize(var a: TAutoCreate<T>); class operator Copy(constref a: TAutoCreate<T>; var b: TAutoCreate<T>); class operator AddRef(var a: TAutoCreate<T>); end; just curious and I thought I’d ask. Regards, Ryan Joseph _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal