Declare global in called table goes away following lookup?
Brian K. White
brian at aljex.com
Sun Aug 19 14:40:58 PDT 2007
Just for giggles I'd declare the variable global.
the other kind of global, MyKey(10,*,g)
If the lookup were "lookup -" I'd say this was no bug,
but I wouldn't have expected "lookup alias = @fi" to clear any values
either.
ps:
I think we need a new term for one or the other meanings of global, like for
,g I think it should really be called "persistent" even though it will have
to continue to be indicated with ",g".
The long variable meaning for global is really what global usually means and
is more correctly named.
Even consulting thesaurus.com I can't find a word that means persistent but
starts with g.
Closest is, 2 hops away, synonym of a synonym of persistent, is "general",
which I don't like as it's to , uh, general. Rather give up on the g and use
one of the entertaining anthropomorphic possibilities, like stubborn,
obdurate, retentive, hah that one's even technically correct :) one other G
thats 2 hops away, grim, synonym of unrelenting. heh, no. Or, what the heck,
might be funny just to have to explain to people how the term came about and
why we call them grim variables now...What other programming language has
stories like that?
giant? as in the giant lock in the freebsd kernel (a lock that affects
everything everywhere). Or, grand? great? These don't really mean persistent
but could sorta work.
Brian K. White brian at aljex.com http://www.myspace.com/KEYofR
+++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++.
filePro BBx Linux SCO FreeBSD #callahans Satriani Filk!
----- Original Message -----
From: "Barry Wiseman" <barry at gensoftdes.com>
To: <filepro-list at lists.celestial.com>
Sent: Sunday, August 19, 2007 4:02 PM
Subject: Declare global in called table goes away following lookup?
>
> Linux dclerk 5.0.14D4 (I know, I know)
>
> My variable is a declare global in the called table, a declare extern in
> the
> main table. I am loading the variable in the main table, then doing the
> call.
> All is well until the called code performs a lookup, following which the
> variable has become blank. The following test code demonstrates the
> problem:
>
> -------------------
> MAIN TABLE
> -------------------
> ::end:
> @MENU::call "library/test" ' so declare globals will be performed:
> ::end:
> ::':
> ::declare extern MyFile:
> ::declare extern MyKey:
> ::declare extern Flag:
> ::':
> @ENTSEL::MyFile=@fi; MyKey=1:
> ::msgbox "Calling table\nMyKey=" { MyKey:
> ::Flag="1":
> ::call "library/test":
> ::end:
>
> ------------------------
> CALLED TABLE
> ------------------------
>
> ::declare global MyFile(10,*):
> ::declare global MyKey(10,*):
> ::declare global Flag(1,*):
> :Flag eq "1":goto one:
> ::end:
> ::':
> ONE::msgbox "Called table before lookup\nMyKey=" { MyKey ' here MyKey
> has its
> value:
> ::lookup rec = (MyFile) k=(MyKey) i=a -bx:
> ::msgbox "Called table after lookup\nMyKey=" { MyKey ' here MyKey
> has
> become blank:
> ::end:
>
> This behavior occurs only when the lookup is back to the file the main
> table is
> standing on, and is not affected by whether the lookup succeeded or
> failed.
> When I load MyFile with some other filename instead of @fi, then MyKey
> retains
> its value in the final msgbox.
>
> I can of course easily work around this by saving the global data into
> local
> variables and using them instead, but!
> If it walks like a bug, and quacks like a bug....
>
> --
> Barry Wiseman
> Genesis Software Designs, Inc.
> 55 W 45 Street, New York, NY 10036
> (212) 889-9191 Fax: (212) 889-1589
> _______________________________________________
> Filepro-list mailing list
> Filepro-list at lists.celestial.com
> http://mailman.celestial.com/mailman/listinfo/filepro-list
>
More information about the Filepro-list
mailing list