Archive for the ‘RTTI’ Category.

RTTI errors and omissions in Delphi XE

I’ve been playing around with DeHL a lot lately.  Embarcadero’s own Alex Ciobanu wrote this library, which provides a lot of useful functionality, including a set of querying methods that, while a bit bulky, are probably the best we’re gonna get until the compiler team gets around to implementing LINQ as a language feature.  (Which I really hope they will do.) Continue reading ‘RTTI errors and omissions in Delphi XE’ »

First look at Delphi XE

This week’s just getting started, and it’s already had more than enough awesomeness to pack into a typical month.  The new version of Delphi came out yesterday.  Metroid: Other M and The Way of Kings, a new Brandon Sanderson book, were both released today.  (I have a feeling I’m going to be more distracted than usual for a while…) But as awesome as Metroid games and anything by Sanderson tend to be, (if you’re into fantasy at all, check out Elantris and Mistborn and prepare to be blown away,) this is a programming blog, and I’m supposed to be talking about Delphi.  So here’s the good, the bad, and the annoying about my first impressions with Delphi XE.

Continue reading ‘First look at Delphi XE’ »

Adding non-data fields to a client dataset

A lot of the UI design for the TURBU editor is based on data-aware controls bound to client datasets.  I was trying to build a new form this morning that required me to filter one of the datasets.  Problem is, that would break other things that expected it not to be filtered.  Well, that’s not such a big problem, because TClientDataset has an awesome method called CloneCursor that lets you set up a second client dataset that shares the first one’s data store, but with independent view settings.  So I used a cloned dataset, and immediately got an exception when I tried to run.  The control I was using couldn’t find the field.

Continue reading ‘Adding non-data fields to a client dataset’ »

Closing the documentation gap

This morning on StackOverflow, someone asked a question about invoking constructors through extended RTTI. It happened that I’d had to work out a way to do that a couple weeks ago, and it took me about 5 minutes to find the code, strip out a few specific details and type up a solution.  I got an accepted response, a few upvotes, and a very interesting comment from the author:

Continue reading ‘Closing the documentation gap’ »

TValue is very slow!

Delphi 2010’s help describes TValue, used by the RTTI unit to store values of arbitrary types, as “a lightweight version of the Variant type.” I saw that and it made me wonder, how lightweight is it? How fast is using TValue?

Thankfully, among D2010’s lesser-known new features is the Diagnostics unit, which gives us TStopwatch, a simple record for timing operations. That makes it very easy to write a simple speed test.
Continue reading ‘TValue is very slow!’ »

Abusing extended RTTI for fun and profit

I’ll admit, I don’t like the default settings for Delphi 2010’s extended RTTI.  Making almost everything included by default ends up compiling a ton of junk into the EXE, most of which will never get used.  But every once in a while, you can find some sort of use for it.

Continue reading ‘Abusing extended RTTI for fun and profit’ »

Under the hood of an anonymous method

I woke up this morning and checked DelphiFeeds, and found a very interesting post by Jolyon Smith about the use of the absolute keyword.  That reminded me that I had to go and write up this article.  Why?  Because it’s the only way I know of to get inside an anonymous method’s functor object and do some looking around.

Continue reading ‘Under the hood of an anonymous method’ »