Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: Ask Reuben 13 - No More Globals  (Read 5822 times)
Reuben B.
Four Js
Posts: 1116


« on: April 29, 2020, 05:29:30 am »

Does your code make use of GLOBALS, and do you find maintaining that code can be troublesome?   To increase code re-usability and readability, use modular concepts and define PUBLIC variables in one or more modules that are imported into other modules as required with the IMPORT FGL instruction.  In short ...
 
Code
  1. GLOBALS "filename.4gl"
  2.  

... can be replaced with ...
 
Code
  1. IMPORT FGL fileName
  2.  


... and in this module, the GLOBALS keyword ...
 
Code
  1. GLOBALS
  2. DEFINE variableName dataType
  3. END GLOBALS

... can become ...
 
Code
  1. PUBLIC DEFINE variableName dataType
  2.  

You can split your monolithic globals file into one or more smaller modules as required, and only reference the appropriate modules.
 
Read more at https://4js.com/ask-reuben/ig-13/

Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines