[fpc-devel] Pointer cache for fast class/pointer access.

Sven Barth pascaldragon at googlemail.com
Wed Jan 4 15:12:24 CET 2012


Am 04.01.2012 14:51, schrieb Marcos Douglas:
>>> I thinking if the Object type will be deprecated in the future... I hope
>>> not.
>>
>>
>> As Free Pascal still writes on its flag that it is compatible to Turbo
>> Pascal I doubt that it will be deprecated (also there is quite some code in
>> the compiler and also in some packages which use object).
>
> Good to know  ;)
> And, as somebody asked, what the advantages (performance?) using
> Object instead Class?

They are basically similar to "records with methods" (which we now have 
as well...) if you use them directly (this means: not as pointer types): 
they are located on the stack and nested objects are part of the memory 
structure of the object. But if you use references to objects you work 
more like with classes as you have constructors, virtual methods and the 
objects are then located on the heap (thus you need to care for the 
memory management yourself).

>
> I like to use Object to group routines instead of using
> procedure/functions... as a 'namespace' to not use the unit name as a
> prefix.
> I would to know what do you, guys, think about it.

I haven't implemented objects yet myself (besides testing whether some 
feature that was implemented for classes works for objects as well - 
which many features do!) and I also haven't used the new advanced 
records, so I'm the wrong person to ask this question ;)

Regards,
Sven



More information about the fpc-devel mailing list