[Estimated Reading Time: 7 minutes] In my previous post I talked about how “namespaces” in Delphi really don’t exist for any practical purposes normally associated with the concept. Having become familiar with the concept in other languages I found I was missing them, so I devised a way to obtain some of the benefits, despite the shortcomings in the language.
[Estimated Reading Time: 4 minutes] A recap of unit aliases and how they relate to namespace prefixes as a prelude to a more interesting examination of Scope Elevation.
[Estimated Reading Time: 2 minutes] A quick post on a small but hugely useful little language feature in Oxygene… if expressions.
[Estimated Reading Time: < 1 minute] My most recent posts have prompted a bit of discussion, and it seems some concern, regarding the implementation of Boolean values in Delphi. The concern at least I think is unwarranted, as long as you avoid explicitly comparing a Boolean value to the True constant and allow the compiler to logically evaluate the Boolean itself. But in the follow up investigations of one commenter (thank you Arthur), a further occurrence of the alternate -1 identity of True has been identified: Variants.
[Estimated Reading Time: 4 minutes] It has been observed that the Delphi documentation states that the constants True and False have the values 1 and 0 respectively, not the -1 and 0 that the default string conversions apply. This does actually make sense but also lays a trap for the unwary.
[Estimated Reading Time: 5 minutes] Jaap Van Goor was asking on FaceBook about some seemingly strange behaviour when obtaining string representations of Booleans using the Delphi RTL, which led me to revisit some familiar (and some not so familiar) old Delphi ground and take a look at the area involved in further detail.
[Estimated Reading Time: 2 minutes] In my previous post on Anonymous Classes I erroneously referred to them as “dynamic objects” (thanks to commentors for pulling me up on that). Dynamic objects are something else entirely (although what precisely they might mean can vary on different platforms and in different languages). I have now corrected that post on this point, and also on another point that Marc Hoffman called me out on (again, thanks for that). And so the time has now come to expose the true identity of these so called “Anonymous Classes”.
[Estimated Reading Time: 5 minutes] There is another use case for anonymous classes, even simpler than that of providing implementations of interfaces: Anonymous POCO’s.
[Estimated Reading Time: 4 minutes] A few years ago (2011 to be precise) someone asked a question on StackOverflow about support for anonymous classes in Delphi. The reason for the question was that the poster was trying to use Delphi to develop for Android and on that platform the widespread use of callback interfaces makes anonymous classes highly desirable.
[Estimated Reading Time: 3 minutes] I’m afraid I have been guilty of editorialising on StackOverflow. It was sheer laziness really. A question prompted me to respond by sharing a personal preference and instead of “context switching” to my blog I posted an answer that even at the time I acknowledged was not in fact an answer (though as transgression go I have to say I have seen far worse, but, that’s no excuse). So, with (further) apologies to StackOverflow, I have withdrawn that answer and instead present that editorial here, a more appropriate forum.