For Programmers: Free Programming Magazines  


Home > Archive > Tcl > May 2006 > Re: ing by symbolic constants









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: ing by symbolic constants
stephanearnold@yahoo.fr

2006-05-23, 8:07 am

Hi,

You could use a global (or namespace-qualified) array to store your
constants.
That is what I've done with logging levels (WARNING, DEBUG, and so
on...)
Basically this could be:

array set Types {TypeOne TypeOne TypeTwo TypeTwo TypeThree TypeThree}
..=2E.
set type $::Types(TypeOne) ; # here typing errors are detected

I admit my solution would not fit everywhere.

Regards
St=E9phane

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com