Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2004-01

classes for ordinal vars

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Charl

Hi

I have been wondering about creating a unit with classes representing normal variable types, like a TIntegerObj, TCharacterObj, etc. The idea comes from Java, and I have found some occations when this would have been very helpful.

Basically I have two question about this: Is there something similar already in the FCL?
And, what is the performance issues in FP about creating new objects? (example:, what kind of performance issues would there be when you create and work with a TObjectList with loads of TIntegerObj instances, instead of a normal TList containing integer pointers)

Peace.
Charl

Michael Van Canneyt
to Charl
Charl wrote 9 lines
Hi I have been wondering about creating a unit with classes representing normal variable types, like a TIntegerObj, TCharacterObj, etc. The idea comes from Java, and I have found some occations when this would have been very helpful. Basically I have two question about this: Is there something similar already in the FCL?

No.

And, what is the performance issues in FP about creating new objects? (example:, what kind of performance issues would there be when you create and work with a TObjectList with loads of TIntegerObj instances, instead of a normal TList containing integer pointers)

There would be a serious slowdown, as each object must be allocated on the heap. If you want to do such a thing, I suggest you write a separate heapmanager, which does some optimization for small blocks.

Michael.