[V4REV] symbolic constants

Robert Brenstein rjb at robelko.com
Fri May 13 01:52:29 CDT 2005


>Hi Revolution developers,
>
>I have try implement in V4REV set of symbolic constants as we have them in
>V4RB and V4MD.
>
>This is what works now
>
>-------------------------------------------------------
>on mouseUp
>   global EVDebugLevel_kLogParams
>
>   get valentina( "Init", 8 * 1024 * 1024 )
>
>   get Valentina( "DebugLevel", EVDebugLevel_kLogParams )
>

I don't get how do I choose the debugging level I want to set if 
EVDebugLevel_kLogParams is assigned by Valentina. Or do I 
misunderstand something?


>   -- get some parameters to display them:
>   put Valentina( "Version" ) into field efVersion
>   put Valentina( "CacheSize" ) into field efCacheSize
>   put Valentina( "DebugLevel" ) into field efDebugLevel
>
>end mouseUp
>-------------------------------------------------------

How will Valentina distinguish these two:

   get Valentina( "DebugLevel", EVDebugLevel_kLogParams )
   put Valentina( "DebugLevel" ) into field efDebugLevel

I mean how Valentina knows which one is get and which one is set?

>
>As you know external can get/set GLOBAL and LOCAL variables.
>So on start V4REV can produce about 50-100 such constants with correct
>values.
>
>As you see only problem, that in Transcript, you must declare it as
>     global
>
>On start of function to access it. Annoying as for me.
>But IMHO still better then just
>
>   get Valentina( "DebugLevel", 3 )
>
>
>What you think?
>
>Note, at least you are NOT forced to use these symbol names.
>     you still can use numeric constants.

a) I wonder about memory by you declaring hundred of constant behind 
our back and possibly us not even using any of them. Not mentioning 
that we would need to have all of them documented. I don't see that 
as much of help.

b) declaring a globals by us is not a problem per se. However, if I 
have to declare over and over a series of constants with names like 
EVDebugLevel_kLogParams, it will be more effort than it is worth it. 
Lots of typing with plenty of chances for typos whereas typing a 
constant will be always simpler and less error prone.

c) instead of creating a hundred of variables, it may be better to 
create a single array variable, so there is only a single name to 
declare as global. Surely more user-friendly and more 
self-documenting. And we can get a list of all declared values in a 
single call, using the keys() function.

d) may be such a global should not be assigned automatically when 
Valentina external is called, if I follow your suggestion correctly, 
but there is be a function we call specifying the name of the array 
we want to be filled. First, you can't know whether we call 
debuglevel or init or version first. Second, we may want a different 
name for the global. Or we may prefer it to be local rather than 
global.

Robert Brenstein


More information about the Valentina mailing list