[fpc-pascal] with in classes/records
Maciej Izak
hnb.code at gmail.com
Mon Sep 3 11:39:15 CEST 2018
pon., 3 wrz 2018 o 09:15 Ryan Joseph <ryan at thealchemistguild.com>
napisał(a):
> To summarize what I said last time was that I wanted a way to include
> “with” statement functionality in classes and records to aid in delegation
> patterns (in leu of multiple inheritance in Pascal). As it turns out the
> idea is relevant to management operators and something similar using
> properties was requested by the developer of management operators (Maciej).
>
> He suggested a “default” property which would basically delegate
> methods/field calls to another class so to avoid having to do things like
> "obj._.Free” which would be shorted to “obj.Free” because the field “_” is
> default. As he pointed out if such a default property existed I could
> leverage management operators to auto manage objects instead of adding
> anything more to the compiler like I did in my version. That’s a really
> important advancement for FPC and I’m personally very motivated in seeing
> this manifest in the language.
>
you can always track my work on NewPascal and prepare/extract patch for
FPC. The existing implementation of "default field" can be partially used
for "default property without indexers" implementation (small note: the
part of storing info for ppu for default field is really lame and should be
done in other way - but works :P - this was one of my first work for
compiler and should be reworked).
Please note that multiply default property is not best idea.
You can always wait for my implementation because I am working on this (in
free time, feature rather expected at the end of year) and you can extract
patch and submit to FPC (or create your own earlier if you wish). "Default
field without indexer" will be needed for Delphi compatibility sooner or
later (especially for nullable types).
--
Best regards,
Maciej Izak
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20180903/578f22e6/attachment.html>
More information about the fpc-pascal
mailing list