I thought using "with" with a single argument, not nested, would be a clean
and elegant practice, like:

  with stringgrid1 do
  begin
    cells[5,tcgmax]:=uline;
    cells[6,tcgmax]:=uline;
    nextstrgrdMaTC;
    cells[3,tcgmax]:='Totals';
    cells[5,tcgmax]:=inttostr(trntotu);
    cells[6,tcgmax]:=xfformat('deitos','',trntot,10,2);
  end;

It doesn't confuse the Code Insight either (something Malcolm Groves said is
a disadvantage of using it....)

John


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Stephen Barker
Sent: Friday, 11 May 2007 12:15 p.m.
To: NZ Borland Developers Group - Delphi List
Subject: RE: [DUG] Why use a set when a string will work OK (and less code
)?


Hi Neve  :)

I'm not one of the many who don't use the with statement at all, but I only
use it sparingly and never nested 3 levels deep like the example. I usually
end up removing it during debug sessions anyway and kick myself for using it
in the first place.

I think your mate Malcolm Groves sums it up best in his article a few years
back:

http://www.malcolmgroves.com/stories/2004/04/05/writingSolidDelphiCode.html

(Under the heading "Hard to see, the Dark Side is" about 2/3 down the page.)

Steve 
(I guess because like the with statement it saves a little typing and one
syllable)

 

> -----Original Message-----
> From: Neven MacEwan [mailto:[EMAIL PROTECTED]
> Sent: Friday, 11 May 2007 10:28 a.m.
> To: NZ Borland Developers Group - Delphi List
> Subject: Re: [DUG] Why use a set when a string will work OK 
> (and less code )?
> 
> Steve
> 
> Please explain? also why you are at it why is the diminutive
> of Stephen Steve?
> 
> Neven
> > Interesting stuff...
> > Is it just me or is anyone else horrified by the with
> statement abuse
> > in example function getStructures?
> >
> > Steve
> >
> >   
> >> -----Original Message-----
> >> From: Sean Cross [mailto:[EMAIL PROTECTED]
> >> Sent: Thursday, 10 May 2007 1:49 p.m.
> >> To: NZ Borland Developers Group - Delphi List
> >> Subject: RE: [DUG] Why use a set when a string will work
> OK (and less
> >> code)?
> >>
> >> Q.  What is the function to return the enum name?
> >> A.  See http://www.techtricks.com/delphi/enumname.php
> >>
> >>
> >> Regards
> >>
> >> Sean Cross
> >> IT Systems Development Manager
> >>
> >> Catalyst Risk Management
> >> PO Box 230
> >> 50 Dalton St
> >> Napier 4140
> >> DDI: 06-8340362
> >> mobile: 021 270 3466
> >> Visit us at http://www.catalystrisk.co.nz/
> >>
> >> Offices in Auckland, Napier, Wellington & Christchurch
> >>
> >> Disclaimer:
> >> "The information contained in this document is confidential to the
> >> addressee(s) and may be legally privileged. Any view or opinions 
> >> expressed are those of the author and may not be those of Catalyst 
> >> Risk Management. No guarantee or representation is made that this 
> >> communication is free of errors, viruses or interference. 
> If you have
> >> received this e-mail message in error please delete it and
> notify me.
> >> Thank you."
> >>
> >>
> >>     
> >>> -----Original Message-----
> >>> From: [EMAIL PROTECTED] [mailto:delphi-
> >>> [EMAIL PROTECTED] On Behalf Of Myles Penlington
> >>> Sent: Thursday, 10 May 2007 11:18 a.m.
> >>> To: NZ Borland Developers Group - Delphi List
> >>> Subject: RE: [DUG] Why use a set when a string will work OK
> >>>       
> >> (and less
> >>     
> >>> code)?
> >>>
> >>> The advantage of enumerated types is strong compiler type
> >>>       
> >> checking. Ie
> >>     
> >>> no spelling/keying mistakes.
> >>> If you use the normal convention for enumerated types, .e.g
> >>>
> >>> MyStayus = (msActive, msPending, msEnded ) etc
> >>>
> >>> Then you can use a function and RTTI to convert the
> enumerated type
> >>> name into a string for display. There is a RTTI function
> >>>       
> >> that returns
> >>     
> >>> the name of an enumerated type e.g. "msActive", and then
> >>>       
> >> your function
> >>     
> >>> can strip off the leading lowercase characters.
> >>>
> >>> Myles.
> >>>
> >>>
> >>>       
> >> _______________________________________________
> >> NZ Borland Developers Group - Delphi mailing list
> >> Post: [email protected]
> >> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> >> Unsubscribe: send an email to [EMAIL PROTECTED] with
> >> Subject: unsubscribe
> >>
> >> No virus found in this incoming message.
> >> Checked by AVG Free Edition.
> >> Version: 7.5.467 / Virus Database: 269.6.6/795 - Release
> >> Date: 9/05/2007 3:07 p.m.
> >>  
> >>
> >>     
> > _______________________________________________
> > NZ Borland Developers Group - Delphi mailing list
> > Post: [email protected]
> > Admin: http://delphi.org.nz/mailman/listinfo/delphi
> > Unsubscribe: send an email to [EMAIL PROTECTED] with
> > Subject: unsubscribe
> >
> >
> >   
> 
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: [email protected]
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to [EMAIL PROTECTED]
> with Subject: unsubscribe
> 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.467 / Virus Database: 269.6.6/795 - Release 
> Date: 9/05/2007 3:07 p.m.
>  
> 
_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: [email protected]
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject:
unsubscribe

__________ NOD32 2245 (20070506) Information __________

This message was checked by NOD32 antivirus system. http://www.eset.com



_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: [email protected]
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe

Reply via email to