On Fri, 4 Jun 2010, spir wrote:
Hello Pascaleers,
-1- class wrappers
Are there in stock implementations of class wrappers for primitive types: such
as TInteger, TString, etc? (that would for instance just hold a .value attr and
delegate operations to builtin funcs or procs) This would save me some work :-)
No. They are planned. They partially exist for the objectivec import layer.
(although they may be semantically different there)
-2- [] operator
How to implement a class that manages this operator (did not find it in the
operator overloading section). Pointer welcome (including to the implementation
of eg TFPList).
[] is not an operator. It is a set notation.
Or it is used as a notation for selecting elements from an array.
But that also is not an operator.
-3- List specialization
What is actually needed to specialise TFPList or TObjectList, in order for
an instance of the new list class to hold as elements instances of a
subclass of TObject. (The main purpose for this specialisation is to
avoid systematically casting back elements to TMyObject). I guess I only
need to redefine the .List or .Items property, but to do what, actually
(maybe the main issue jumps back to question -2-)?
What you want - no typecasts - needs to be accomplished using generics,
see the fgl unit.
If typecasts are OK: just look at the contnrs unit, there you have several
descendents of the TList class.
Michael.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal