02/12/2010

Find, you

Posted by – February 12, 2010

Last weekend, I decided to pick up my Delphi compiler and work a bit on Fandro: in real life, I found out that I wanted to be able to launch Fandro from Explorer’s context-sensitive menu and henceforth, I worked on adding support for this.

I always thought doing Win32 was fairly simple in Delphi. Additionally, Borland used to have excellent demos and sample apps with full sources. However during this short coding stint, I admit, programming in Delphi ended up being sort of a pain, mainly because I’ve been by Visual Studio. And I always thought the language’s assignment statement was silly. There’s another thing of Pascal that has bothered me for ages: the fact that to return values from functions you can use the special ‘result’ variable or the function’s name. As in:

function MyOperation(a, b : integer) : boolean;
begin
   result := (Ord(a > b) = Ord( b < a))
end;

function MyOperation(a, b : integer) : boolean;
begin
   MyOperation := (Ord(a > b) = Ord( b < a))
end;

I don't consider myself a Delphi programmer anymore: however, don't you just love the part where compiling code actually means generating a stand-alone Win32 application?

Note: I believe that Delphi statement above holds the answer of life and it's this year's Valentine's present to you.