I'm a big fan of constants. I have some libary files that contain many constant definitions that are used in many the libary methods but are change depending on the site where Active4D runs. Therefore I have to maintain different versions of the libary for my development and production sites. Things may have changed with the upcoming 4.0, but my experience with 3.0 was that the define function only allows literals in constant assignments.

You can do this

   define (kFOO;"foo")

but not this

   define (kFOO;value resulting from an expression)

You also can't do this:
   define (kFOO;"foo")
   define (kFOOBAR; kFOO + "bar")

In my development version of the library I might have

       define (BCRHOST;"bcr.dev.mysite.com")
       define (ECRHOST;"ecr.dev.mysite.com")
       define (TTSHOST;"tts.dev.mysite.com")
       define (ERRHOST;"www.dev.mysite.com")

In my production version of the libary these constants would be different

       define (BCRHOST;"bcr.mysite.com")
       define (ECRHOST;"ecr..mysite.com")
       define (TTSHOST;"tts.mysite.com")
       define (ERRHOST;"www.mysite.com")

I've occasionnally ran into problems where I accidently put the wrong libary in a site. It's easy to catch those errors, but I wish there was an easier way to manage this situation.

What would be nice is to have some kind of library specific conditional where I could test if I was running on development or production

#IF (Some condition)
       define (BCRHOST;"bcr.mysite.com")
       define (ECRHOST;"ecr..mysite.com")
       define (TTSHOST;"tts.mysite.com")
       define (ERRHOST;"www.mysite.com")
#ELSE
       define (BCRHOST;"bcr.dev.mysite.com")
       define (ECRHOST;"ecr.dev.mysite.com")
       define (TTSHOST;"tts.dev.mysite.com")
       define (ERRHOST;"www.dev.mysite.com")
#END IF

Because define won't make an assignment based on an expression I can't do this:

define (BCRHOST;choose(sometest;"bcr.dev.mysite.com";"bcr.mysite.com")) Has anyone else had to deal with this situation and if so how did you solve it?

Thanks,

Brad Perkins





_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Reply via email to