In a function node I retrieve a global variable and assign it to a message property.
var a = global.get('var_a');
msg.a = a;
In another node I manipulate msg.a.
I notice that next time I call global.get('var_a'), the changes I made throughout the message's lifetime have persisted without calling global.set('var_a',msg.a);
No. Unless I am reading your question wrong.
Does this look like what you are asking:
[{"id":"e902913.398717","type":"inject","z":"1534182a.9ba0d8","name":"SET","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":210,"y":240,"wires":[["5ad7a283.8c652c"]]},{"id":"5ad7a283.8c652c","type":"function","z":"1534182a.9ba0d8","name":"","func":"msg.a = 35;\nglobal.set('var_a',msg.a);\nreturn msg;","outputs":1,"noerr":0,"x":410,"y":240,"wires":[["f23b694d.075668"]],"info":"var a = global.get('var_a');\r\nmsg.a = a;\r\n\r\nIn another node I manipulate msg.a.\r\n\r\nI notice that next time I call global.get('var_a'), the changes I made throughout the message's lifetime have persisted without calling global.set('var_a',msg.a);"},{"id":"f23b694d.075668","type":"debug","z":"1534182a.9ba0d8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":570,"y":240,"wires":[]},{"id":"c1761838.7e9e18","type":"inject","z":"1534182a.9ba0d8","name":"GET","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":210,"y":360,"wires":[["7c242a54.e26d74"]]},{"id":"7c242a54.e26d74","type":"function","z":"1534182a.9ba0d8","name":"","func":"var var_a = global.get('var_a') || 0;\nmsg.a = var_a;\nreturn msg;","outputs":1,"noerr":0,"x":420,"y":360,"wires":[["13fcbf20.e21011"]]},{"id":"13fcbf20.e21011","type":"debug","z":"1534182a.9ba0d8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":590,"y":360,"wires":[]},{"id":"b0dfc02.efe3d4","type":"inject","z":"1534182a.9ba0d8","name":"CHANGE msg.a","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":200,"y":300,"wires":[["79d4a873.355fe8"]]},{"id":"79d4a873.355fe8","type":"function","z":"1534182a.9ba0d8","name":"","func":"msg.a=28;\nreturn msg;","outputs":1,"noerr":0,"x":400,"y":300,"wires":[["8a3a05f.0b0b4f8"]]},{"id":"8a3a05f.0b0b4f8","type":"debug","z":"1534182a.9ba0d8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":580,"y":300,"wires":[]}]
I have three flows. One sets the global, one changes the var, and the last reads the global. It isn't changed.