Jason Southwell (from arcana) just published DuckDuckDelphi: a unit to do Duck typing in Delphi XE2 (not XE)
Posted by jpluimers on 2012/02/16
If you haven’t seen Jason announce this in the general Delphi 3rd party newsgroup or his announcement thread on the FaceBook Delphi Developer group yet, this is a definitive must read:
Jason Southwell (from arcana) just published DuckDuckDelphi: a unit to do Duck typing in Delphi XE2 (not XE):
Duck Duck Delphi
DuckDuckDelphi is an Open Source (MIT License) unit for Delphi XE2 which adds duck typing functionality to a normally strongly typed language.
Great stuff that makes a truckload of my code so much easier to maintain.
–jeroen
(Edit: 1400 UTC+1 Sorry, wrong boolean; wrote “and” but should be “not” XE).






antonio said
Duck type? Isn’t that what stage hands use to stick wires to the floor?
jpluimers said
That depends on how badly your pronounce English ;)
Duct Tape is not for sticking wires to stage floors, that is Gaffer tape; Duck typing a software development thing :)
http://en.wikipedia.org/wiki/Duct_tape versus http://en.wikipedia.org/wiki/Gaffer_tape versus http://en.wikipedia.org/wiki/Duck_typing
Jason Southwell said
If anyone wants to be responsible for XE compatibility, I can make them a contributor to the project. I don’t run XE any more and have no desire to maintain anything less than XE2.
Markus said
@Jason, a quick glance at the source indicated, that TRttiIndexProperty is quite important for a lot of functionality. Since this is not available for XE, I think it will not become easy to make it compatible with XE. Since I don’t have XE2 I can’t have a look into Delphi’s RTTI unit to see how complicated it would be to implement something similar for XE. I even don’t know if XE actually generates RTTI for indexed properties and that the guys at Embarcadero simply forgot to surface it in the XE reflection classes or if no RTTI for indexed properties is generated at all. If I find some spare time, I will have a look at it, as I see a lot of potentials for your duck typing framework.
Jason Southwell said
By removing TRTTIIndexedProperty, the only limitation would be that you would be unable to get or set values of indexed properties. Other properties should work fine.
Having said that, I’m not sure if there are other limitations or not.
Markus said
Not entirely compatible with Delphi XE. It uses TRttiIndexedProperty which was added in XE2. In addition the source uses scoped unit names. But easy to adapt to XE.
Markus said
Correction: It seems not to be so easy to adapt it to XE. @ Jeroen, how did you get it to work under XE ?
jpluimers said
I used the wrong boolean, sorry for that. Not XE; only XE2.