Sign in Join

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

Mailing lists / fpc-pascal / 2010-06

reference model for class instances

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

spir

Hello,

After having read the draft standard proposel for OO extensions for Pascal, esp. the Object Model (http://www.pascal-central.com/OOE-stds.html#sect-6.5.1), I wonder how implicite (de)referencing of class instances is actually implemented in fpc (Delphi-like OO). In particuliar, when is (a ref to) an instance dereferenced, or not?

It seems to me the only case dereferencing does _not_ occur is direct assignement between 2 object variables:
    obj2 := obj1;
including implicite assignment of a parameter:
    doSomething(obj);
If I'm right, in all other cases deferencing must occur to access the object's actual data:
    obj.m(arg);
    x := obj.m(arg);
    obj.p := x;
    x := obj.p;
    x := 1 + f(obj.p+1, 1);
(Note: deferencing also happens on left side of ':=', since p & m are attributes of the references's target, not of the reference itself. Translating the statements to explicite dereferencing using '^' makes this clear.)

Am I right on this?
How does this happen, concretely?

Denis
________________________________

vit esse estrany ☣

spir.wikidot.com

Reply by email