[V4REV] symbolic constants // Based on Assoc Array

Robert Brenstein rjb at robelko.com
Mon May 16 19:45:33 CDT 2005


>  > If you wanted to go all the way, instead of defining constants on our
>>  side (in our program), you could have Valentina functions accept
>>  literals instead of, or in addition to, numerical parameters and have
>>  your external converting these literals into numbers.
>
>Oh! Btw, this is also a way

Yes, this is probably the most intuitive and simplest for users, I 
think. And possibly also for you even though your code must handle 
the strings.

>  > Then the whole issue of val-related globals is out of window. And the
>>  constants are documented clearly and individually for each Valentina call.
>>  This would be a proper emulation of enums in Transcript IMHO.
>
>so:
>
>We can use this way: very similar to Java/RB.
>
>     SQlSelect( query,
>         "EVCursorLocation.kServerSide",
>         "EVLocks.kReadWrite",
>         "EVCursorDirection.kRandom" )
>
>Of course we can also make it shorter:
>
>     SQlSelect( query, "kServerSide", "kReadWrite", "kRandom" )
>
>well, I think second way you will prefer better, right ?
>
>Only it needs to check if all constant names from different "enums" are
>different...

Definitely the second, shorter way. Internally, you can either ensure 
that each constant is different or have them enumerated by function 
name whatever it is easier for you to handle.

In this instance, the quotes are really (at least they should be) 
optional, although it is a good idea to have them anyway.

SQlSelect(query,kServerSide,kReadWrite,kRandom)

Robert


More information about the Valentina mailing list