www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Delphi, virtual method interception

reply bearophile <bearophileHUGS lycos.com> writes:
Despite not being very cool, Delphi language has kept improving. Delphi
language and D shares all (or most) of their design goals. This page found
through Reddit shows features added to Delphi since 2005:

http://www.tindex.net/

From that page this TVirtualMethodInterceptor recently added in Delphi XE seems
interesting:
http://blog.barrkel.com/2010/09/virtual-method-interception.html

Bye,
bearophile
Aug 15 2011
next sibling parent reply bearophile <bearophileHUGS lycos.com> writes:
In Delphi Prism there is the colon operator too:
http://prismwiki.codegear.com/en/Colon_Operator

A quote from another page:

instead of using "." to access members and get a NullReferenceException if they
are nil, use ":" and the call will be skipped for nil (and the result will be
nil itself). For example:

// only call dispose if the interface is implemented.
IDisposable(SomeObject):Dispose;
// access the 3rd parent of a control, where any level might be nil.
x := Button:Parent:Parent:Parent;

Bye,
bearophile
Aug 15 2011
parent Jacob Carlborg <doob me.com> writes:
On 2011-08-16 01:48, bearophile wrote:
 In Delphi Prism there is the colon operator too:
 http://prismwiki.codegear.com/en/Colon_Operator

 A quote from another page:

 instead of using "." to access members and get a NullReferenceException if
they are nil, use ":" and the call will be skipped for nil (and the result will
be nil itself). For example:

 // only call dispose if the interface is implemented.
 IDisposable(SomeObject):Dispose;
 // access the 3rd parent of a control, where any level might be nil.
 x := Button:Parent:Parent:Parent;

 Bye,
 bearophile

That's a nice feature, several other languages has the same feature as well. -- /Jacob Carlborg
Aug 16 2011
prev sibling next sibling parent "Marco Leise" <Marco.Leise gmx.de> writes:
Am 16.08.2011, 01:25 Uhr, schrieb bearophile <bearophileHUGS lycos.com>:

 Despite not being very cool, Delphi language has kept improving. Delphi  
 language and D shares all (or most) of their design goals. This page  
 found through Reddit shows features added to Delphi since 2005:

 http://www.tindex.net/

 From that page this TVirtualMethodInterceptor recently added in Delphi  
 XE seems interesting:
 http://blog.barrkel.com/2010/09/virtual-method-interception.html

 Bye,
 bearophile

Oh come on, Delphi is cool! Don't you see how I cite it everywhere possible, like on the D.learn thread about integer vs. float division where Pascal's 'div' and 'mod' come to the rescue. I'm just waiting for the ideal moment to talk about sets of enum values.
Aug 15 2011
prev sibling parent Jacob Carlborg <doob me.com> writes:
On 2011-08-16 01:25, bearophile wrote:
 Despite not being very cool, Delphi language has kept improving. Delphi
language and D shares all (or most) of their design goals. This page found
through Reddit shows features added to Delphi since 2005:

 http://www.tindex.net/

  From that page this TVirtualMethodInterceptor recently added in Delphi XE
seems interesting:
 http://blog.barrkel.com/2010/09/virtual-method-interception.html

 Bye,
 bearophile

Seems like opDispatch, but for virtual methods. -- /Jacob Carlborg
Aug 16 2011