On 28.01.2016 20:02, Kazantsev Alexey wrote:
On Thu, 28 Jan 2016 22:33:39 +0400, Ondrej Pokorny <[email protected]>
wrote:
why the double-posting?
Because my example answer to your querys:
First, I don't want to publish the TEnumeratedObjects object to the
outside of TTest (e.g. you could call Free on it and do other stuff I
don't want to be allowed).
You can return record, and what is more, record of nested private type
(i.e. user can use your type, but can't declare variable of your type).
Second, TEnumeratedObjects doesn't even need to exist! What about
"virtual" array properties that are not mapped to existing objects?
It because your example very simple. In more complex cases we can have
other methods/overloaded operators in returned record. And it more
flexible solution.
TValueArray = Array Of TObj.TValue;
var va : TValueArray;
Obj.Values.Sort;
va := Obj.Values;
Yes. I see. But I want to add an enumerator to an array property.
TValues is not an array property. It is a record... As I said before
there are some cases I don't want any object/interface/record/banana in
between. I know I can do that the other way. It doesn't matter if you do
it with private record or generic interface or a banana.
I want A and people suggest me B and try to convince me that B is better
and more flexible. But I don't want B, I want A :)
Ondrej
_______________________________________________
fpc-devel maillist - [email protected]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel