Aaron,

> That in both cases the object is modifiable yet only the
> 'var' case allows the reference
> pointer itself to be changed (since the reference pointer is
> passed by reference).

I guess this can be confusing, especially for C++ programmers.  In Delphi,
there is no such thing as an object instance variable.  There are only
object references, which *ARE* pointers.  So, no matter what you do, only
pointers are involved.  In C++, passing an object instance by value invokes
the copy constructor.  In Delphi, only the pointer is copied.

> > In procedure A, you are passing a reference by value, and
> in procedure B,
> > you are passing a reference by reference (ie. pointer to
> pointer).  Where is
> > it that Delphi lies?  Bear in mind that all objects in
> Delphi are references
> > (ie pointers).

> Delphi is not doing an offset when accessing via the '.'
> operator it is in fact doing '^.'
> hiding the fact that the is a dereference involved. The lie
> is that an instance declaration
> is only a pointer declaration...

This is purely syntactical and the help explains this.  In BP7 (old way),
you always do a '^.', but Borland changed that to '.' in Delphi.  Its not a
lie.  It is the way Delphi has been designed, and IMHO, is better than the
'^.' construct, and certainly better than C++'s '.' and '->' constructs.  I
guess the only down-side to using '.' is that it is used to denote fields in
records, thus making its use inconsistent.  However, IMHO, OO programming
ought not to use records anyway.

> Do does delphi handle it's dynamic array passing when passed
> as a typed parameter,
> does delphi pass only the reference or does it still pass the
> entire array as value.

Hmmm.  I would think that Delphi handles dynamic arrays like strings, but
I'm not quite sure, I'll need to check this out ... one free weekend :).

The AnsiString example can be used for this.  Convert it into dynamic
arrays, and check out the pointer values.  Should give you a clue as to what
Delphi is doing.  Will also need to look at the assembly generated.


Regards,
Dennis.

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to