Article

From:
To:
Nick Hodges
Subject:
Re: Delphi Project X Cross GUI
Newsgroup:
embarcadero.public.delphi.non-technical

Re: Delphi Project X Cross GUI

Nick Hodges wrote:
> Brad White wrote:
> 
>> What in the world for??
> 
> You already can do "using" in delphi:
> 
> http://blogs.embarcadero.com/abauer/2008/09/25/38870
> 

This was afraid of.

And do you think that that is a natural, clear, lean-and-mean, compact, readable, maintainable Delphi/Pascal syntax?
Even I know Allen's post since it was issued, and it is pretty straightforward how he did it, I need every time to stay and think how to write the so-called 'using'...
Also, there are enough quirks with the above kludge. Just one of them:
Try to compile the code bellow:
procedure TForm7.btn2Click(Sender: TObject);
   function Foo: string; //simple function    begin      Result:='';
     Obj.Using<TStringList>(TStringList.Create, procedure (List: TStringList) {syntax := yeck!}      begin        List.Add('Enter a value');        List.Add('which will be shown');        List.Add('if the "Using" works ok.');        Result:=InputBox('Testing "Using"', List.Text, '');      end);    end;
begin    ShowMessage(Foo); end;
It will not.
(The 'Result' variable cannot be "captured" by the anonymous procedure)
See http://qc.embarcadero.com/wc/qcmain.aspx?d=63369
and the (somewhat) related...
http://wings-of-wind.com/2010/02/11/community-pulse-delphis-killer-feature/ (The part about variables. Btw, the results of the poll are a little bit surprising, at least for me... :-))
Also you can implement a slightly different...
using <ref=type.constructor> do begin   //code end;
....and have it only for objects.
my2c, HTH & Food for thought.
--
m. Th.
On the Wings of the Wind... http://wings-of-wind.com/
FYI: Phrase searches are enclosed in either single or double quotes
 
 
Originally created by
Tamarack Associates
Mon, 25 Nov 2024 11:54:54 UTC
Copyright © 2009-2024
HREF Tools Corp.