Sun Dec 05, 2021 6:06 pm
Login Register Lost Password? Contact Us


"How to freeze a definition"

Questions around writing code and queries

Wed Dec 30, 2015 3:49 pm Change Time Zone

Hello, I have a very stupid question, sorry for that, I believe I knew the solution in the past but my memory is weak these days ...

Let getTimeStamp () be a function that computes the timestamp when called. Then, in the following pseudo code:

// BEGIN
TIMESTAMP := getTimeStamp (); // PT0

OUTPUT (TIMESTAMP); // PT 1

... SOME TIME CONSUMING OPERATION

OUTPUT (TIMESTAMP); // PT2
// END

the results of the OUTPUTS are different between PT1 and PT2; I know why it is so, but for now I need the value of TIMESTAMP to be "frozen" at what it was at PT0, rather than being re-evaluated: if getTimeStamp () computes 9 at PT0, I need to see 9 at pt2.

I hope this is not confusing.

Could someone be helpful with the old guy and remind him the trick ?

Thanks in advance.

Bests.
tdelbecque
 
Posts: 44
Joined: Thu Sep 06, 2012 10:43 am

Wed Dec 30, 2015 4:21 pm Change Time Zone

Try using GLOBAL in the function call:

TIMESTAMP := getTimeStamp ():GLOBAL;

I think this should work for you.

Regards,

Bob
bforeman
Community Advisory Board Member
Community Advisory Board Member
 
Posts: 1005
Joined: Wed Jun 29, 2011 7:13 pm

Wed Dec 30, 2015 4:29 pm Change Time Zone

Hello Bob, thanks for your quick answer.

Unfortunatelly it does not seem to solve the problem.

Bests, Thierry
tdelbecque
 
Posts: 44
Joined: Thu Sep 06, 2012 10:43 am

Wed Dec 30, 2015 4:33 pm Change Time Zone

Hmmm, that worked for me.

Try INDEPENDENT instead of GLOBAL.

Bob
bforeman
Community Advisory Board Member
Community Advisory Board Member
 
Posts: 1005
Joined: Wed Jun 29, 2011 7:13 pm

Wed Dec 30, 2015 4:37 pm Change Time Zone

Hi Bob,

It works with INDEPENDENT :-)

Thanks very much.

Bests, Thierry.
tdelbecque
 
Posts: 44
Joined: Thu Sep 06, 2012 10:43 am


Return to Programming

Who is online

Users browsing this forum: No registered users and 1 guest