[DUG] class variables - bad language definition

Rohit Gupta rohit at cfl.co.nz
Thu Oct 11 11:24:27 NZDT 2007


That works, the problem is that someone else (or maybe even me) will 
come along and remove the second private as part of cleaning up...  I 
have put a comment there, but I still dont like it.

Myles Penlington wrote:
>
> Then does
>
> type
>    Taa = class()
>    private
>      class var xx : yy;
>
>    private
>       zz : integer
>   public
>
> Work as expected? I.e zz is an instance variable?
>
>  
>
> Myles.
>
>  
>
> *From:* delphi-bounces at delphi.org.nz 
> [mailto:delphi-bounces at delphi.org.nz] *On Behalf Of *Rohit Gupta
> *Sent:* Tuesday, 9 October 2007 11:44
> *To:* NZ Borland Developers Group - Delphi List
> *Subject:* [DUG] class variables - bad language definition
>
>  
>
> Another pitfall for young players.
>
> type
>    Taa = class()
>    private
>      class var xx : yy;
>       zz : integer
>   public
>
>
> The xx declaration makes all other variables after it class ones as 
> well.  I know its documented, but one doesn't realise the impact until 
> after falling in the hole.  And the hole remains in my code for a 
> future developer to fall into.  This is specially bad after being used 
> to the class function declaration which works differently.
>
> I hate this sort of stuff, the code can not become more robust if a 
> declaration of a new variable affects previous declarations.
>
> -- 
>
> *Rohit Gupta*
>
> *B.E. Elec.   M.E.   Mem IEEE    Associate IEE*
>
> *Technical Manager*
>
> *Computer Fanatics Limited*
>
>  
>
> *Tel*     +64 9 4892280
>
> *Fax*    +64 9 4892290
>
> *Email  *rohit at cfl.co.nz <mailto:rohit at cfl.co.nz>
>
> *Web    *www.cfl.co.nz <http://www.cfl.co.nz/>
>
>  
>
> ------------------------------------------------------------------------
>
> This email and any attachments contain information, which is 
> confidential and may be subject to legal privilege and copyright. If 
> you are not the intended recipient, you must not use, distribute or 
> copy this email or attachments. If you have received this in error, 
> please notify us immediately by return email and then delete this 
> email and any attachments.
>
> Attention:
> This communication is confidential and may be legally privileged.  If 
> you are not the intended recipient, please do not use, disclose, copy 
> or distribute it, other than to return it to us with your confirmation 
> that it has been deleted from your system.
> ------------------------------------------------------------------------
>
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject: unsubscribe

-- 
*Rohit Gupta*
* B.E. Elec.   M.E.   Mem IEEE    Associate IEE*
*Technical Manager*
*Computer Fanatics Limited*
** 
*Tel*     +64 9 4892280
*Fax*    +64 9 4892290
*Email  *rohit at cfl.co.nz <mailto:rohit at cfl.co.nz>**
*Web    *www.cfl.co.nz <http://www.cfl.co.nz/>
 
------------------------------------------------------------------------
This email and any attachments contain information, which is 
confidential and may be subject to legal privilege and copyright. If you 
are not the intended recipient, you must not use, distribute or copy 
this email or attachments. If you have received this in error, please 
notify us immediately by return email and then delete this email and any 
attachments.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.adventureeducation.co.nz/pipermail/delphi/attachments/20071011/0ee105d0/attachment.html


More information about the Delphi mailing list