Delphi seemingly makes the distinction between reference and value types disappear, especially because it hides the ^derefererncing operator for most usages:
- there is no ^ dereferencing operator when following “class” type object instances, “interface” references and “object” type object instances, strings, open arrays and dynamic arrays: the dereferencing is implicit
- usually you do not need the ^ dereferencing operator when
Rudy Velthuis wrote a great article on pointers in general. Though it was in the Delphi 2009 timeframe, almost everything is very valid. A few things are missing, some additions are below.
I’m not going into deep detail here right now, just a few notes to get people interested going.
Hopefully I will some time in the future to either go into more detail, or point to articles that do.
- “object” style object instances.
Those have been deprecated since Delphi 1 (which introduced “class” style objects), but there are still libraries that use them, and (almost unbeleivable): they are supported in Delphi x64
- anonymous method references
- Events (method references) aka the “procedure … of object”/”function … of object”
are implemented using the underlying TMethod type from the System unit
always use the “Assigned” method to check if both the Data and Method field are non-nil
Even with those additions to Rudy’s list, I’m not 100% sure everything is complete now (:
–jeroen
via: delphi – Why does TValue.Make require a pointer to an object reference? – Stack Overflow.
Like this:
Like Loading...