[fpc-pascal] there's need for static uninitialized objects

Anton Tichawa anton.tichawa at chello.at
Tue Feb 11 03:23:05 CET 2003


Hello, List!

The postings converning Classes/Objects/Pointers / Pointer Help I've read 
miss one point: There's need for uninitialized, static objects that are 
usable without calling a constructor.

We use static objects to build dynamic ones; but dynamic objects cannot be 
used to build static ones.

Let's assume an object-oriented system where power is switched ON and the 
contents of RAM are unknown. The software then must call a constructor, and 
store the result (the pointer to the first object instance in the system) in 
an object field, in order to work with the new object. But there's no object 
yet where that constructor's result might be stored = contradiction.

IOW, and informally, when there are no static, uninitialized objects, you 
have to withdraw the object-oriented approach from the hardware level up to 
higher, more "sophisticated" (?) levels. Object Pascal would then loose the 
ground under it's feet - it would no more be suited to program an operating 
system using OOP.

Let's stay on this n'th floor = static records, objects and interfaces, 
before looking at "higher" things such as dynamic allocation or virtual 
methods. I suggest, while still supporting all legacy code, to create a new, 
unified approach for records, objects and interfaces. I here use the term 
'whole', but that's just a proposal.

***
type t_star_position = whole  // a record
  declination: real;
  rectascension: real;
  end;

type t_window = whole  // a static object
  x0, y0, x1, y1: integer;
  procedure clear(a_title: string);
  end;

type t_char_device = whole // an interface
  function char_available: boolean;
  function read_char: char;
  end;

I think this could be a new thread, so I renamed the subject.

Anton Tichawa.



----------

"Adas Methode war, wie sich zeigen wird, Tagträume in offenbar korrekte 
Berechnungen einzuweben."

Doris Langley Moore: Ada, Countess of Lovelace (London 1977).

----------

Anton Tichawa
Volkertstrasse 19 / 20
A-1020 Wien
mobil: +43 664 52 07 907
email: anton.tichawa at chello.at

----------



More information about the fpc-pascal mailing list