Archive for the ‘Anonymous Methods’ Category.
October 28, 2009, 9:45 pm
Quick, what’s wrong with this code?
procedure ContrivedExample;
var
factorial: TFunc;
begin
factorial :=
function(input: Integer): integer
begin
if (input = 0) or (input = 1) then
result := input
else result := input * (factorial(input - 1));
end;
writeln(factorial(5));
end;
Continue reading ‘How to leak a class you never defined’ »
October 16, 2009, 12:22 am
I woke up this morning and checked DelphiFeeds, and found a very interesting post by Joylon 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’ »
September 29, 2009, 5:23 pm
When I first saw the announcements for the new Delphi 2009 features, a little more than a year ago, my reactions went something like this:
Unicode: Hmm… looks interesting.
Generics: YES! FINALLY!
Anonymous methods: …huh?
I think that’s pretty much how everyone reacted to anonymous methods at first. Continue reading ‘What’s in a name-less method?’ »