$ cat glob.4gl GLOBALS CONSTANT c1 = "abc"END GLOBALS $ cat main.4gl GLOBALS "glob.4gl"MAIN DISPLAY c1 CALL test()END MAIN $ cat mod1.4gl GLOBALS "glob.4gl"FUNCTION test() DISPLAY c1END FUNCTION $ fglcomp mod1.4gl $ vi glob.4gl -- change constant $ cat glob.4gl GLOBALS CONSTANT c1 = "abcdef"END GLOBALS $ fglcomp main.4gl $ fgllink -o main.42r main.42m mod1.42mERROR(-6216):The global 'c1' has been redefined with a different constant-value.
$ cat glob2.4glPUBLIC CONSTANT c1 = "abcdef" $ cat main.4glIMPORT FGL glob2IMPORT FGL mod1MAIN DISPLAY c1 CALL test()END MAIN $ cat mod1.4glIMPORT FGL glob2FUNCTION test() DISPLAY c1END FUNCTION $ lsglob2.4gl main.4gl mod1.4gl $ fglcomp main -- no need to compile glob2.4gl nor mod1.4gl ! $ lsglob.4gl glob2.42m glob2.4gl main.42m main.4gl mod1.42m mod1.4gl $ fglrun mainabcdefabcdef $ vi glob2.4gl -- change constant $ cat glob2.4glPUBLIC CONSTANT c1 = "abcdefghi" $ fglcomp main && fglrun mainabcdefghiabcdefghi
$ cat glob.4glGLOBALS CONSTANT c0 = "abcdef"END GLOBALS $ cat glob2.4glPUBLIC CONSTANT c1 = "abcdefghi" $ cat main.4glIMPORT FGL glob2IMPORT FGL mod1GLOBALS "glob.4gl"MAIN DISPLAY c0 DISPLAY c1 CALL test()END MAIN $ cat mod1.4glIMPORT FGL glob2FUNCTION test() DISPLAY c1END FUNCTION $ fglcomp main.4gl $ fglrun mainabcdefabcdefghiabcdefghi
$ cat glob.4glGLOBALS CONSTANT c0 = "abcdef"END GLOBALSFUNCTION g_func() DISPLAY "in g_func!"END FUNCTION $ cat main.4glGLOBALS "glob.4gl"MAIN DISPLAY c0 CALL g_func()END MAIN $ fglcomp main.4gl $ fglcomp glob.4gl $ fgllink -o main.42r main.42m glob.42m $ fglrun main.42rabcdefin g_func!
$ c4gl -VIBM INFORMIX-4GL Version 7.51.FC2 Software Serial Number RDS#N000000 $ cat glob.4glGLOBALS DEFINE v0 VARCHAR(50)END GLOBALSFUNCTION g_func() DISPLAY "in g_func: v0=", v0END FUNCTION $ cat main.4glGLOBALS "glob.4gl"MAIN LET v0 = "abcdef" DISPLAY "in main: v0=", v0 CALL g_func()END MAIN $ c4gl -o main.bin main.4gl glob.4gl $ ./main.bin in main: v0=abcdefin g_func: v0=abcdef
#!foo.4glPUBLIC DEFINE x INTEGERPUBLIC CONSTANT ZERO=0FUNCTION bar() DISPLAY "bar"END FUNCTION #!main.4glIMPORT FGL fooMAIN CALL bar() LET x = 0 DISPLAY x DISPLAY ZEROEND MAIN
My question is, why don't Genero simply assumes this new constant value, instead of presenting the error? It has already loaded the constant value for doing the compare. We are trying to understand why it gives this error instead of assuming the new value.