Thursday, June 5, 2025

Golf 601.4.32 released

This is a major new Golf release. Here's the summary of changes, with items that may require code changes marked with (Code) in front. There is only three of those and they aren't major code changes. Most are either new features, enhancements or bug fixes.

  • RELRO (Relocation Read Only) is now added to all Golf executables and libraries, including those produced by Golf (meaning applications you build with Golf). This increases safety and prevents certain sections of ELF binaries from being overwritten.
  • Added new number/bool arrays, in addition to string ones. To use them, simply add "type" clause in new-array statement. The arrays operate the same way regardless of the type.
  • Fixed various issues with debian packaging, including the unnecessary dependencies.
  • Added -ignore-warn to gg. Some Golf statements will produce warnings, and you can suppress them with this option. In general, it's best to take care of the potential issues though.
  • Fixed an issue when a request name is a reserved C word. A proper error is now emitted.
  • Fixed a bug in passing arrays as parameters with set-param/get-param. This would occur only with process-scoped arrays in some cases.
  • Added support in get-time statement for epoch time. You can now obtain time as "since-epoch" (meaning the number of seconds since the Epoch, including the negative values for the past), as well as produce time with "from-epoch" clause. Along with existing feature of adding time offset and formatting time output, these provide powerful time constructs.
  • Fixed a bug with mgrg program manager during startup when Golf is installed in a user directory (i.e. not installed system-wide).
  • Added "return-value" clause to call-handler and "return-handler" statement now has a return value. This enables you to pass a number as a return value from a request handler, making it easier to get the status of running a handler. 
  • New simplified print-out and print-format are now available with the same functionality as the existing of p-/pf- statements (which are still available, but their usage will generate a warning to replace them with the new ones).
  • Added boolean expressions with logical operators ! (not), && (and), || (or) and parenthesis ().
  • Added setting boolean variables directly with a "if-true" condition by using new "from-condition" clause.
  • (Code) Clauses "webencode" and "urlencode" have been replaced with more readable web-encode and url-encode.
  • (Code) Statement "handler-status" has been replaced with "exit-status" to better reflect its purpose. Similarly "handler-status" clause in run-remote statement has been replaced with "exit-status" clause for the same reason.
  • Unused variables now reported by gg utility to increase quality of the code.
  • Type checking is now more robust, with issues where type of variable is not recognized fixed.
  • Added support for all escape sequences such as \n, \f, \b etc.
  • Proper error is now emitted if {} code blocks are unbalanced.
  • (Code) The end counter is start-loop now has value of 1 over the last iterator, as it is customarily expected in such loops. This may require code change if your application depends on this value.
  • if-defined statement now has lesser-than, greater-than and other similar clauses to check the value of defineds. Names that start with underscore (_) are now valid as well.
  • Statement get-req now has "source-file" clause to obtain the current source file name.
  • Added abs-number statement to get an absolute number value.
  • Added new-string statement to create new memory. This is useful in cases where memory is manipulated byte by byte.
  • Statement set-string now has  "set-length" clause to set the length of memory created with new-string statement.
  • Statement unused-var now allows for a list of variables separated by a comma.
  • Added statement get-lifo, with an option to get the count of items in the LIFO.
  • Added statement quit-process to quit the current server process; useful when you want to do it programmatically, such as to reboot the server or for upgrades.
  • Fixed several issues with error reporting.
  • Fixed issue with tests that caused false negatives; patch 601.4.15 is effectively the same as .9 because of  it (and because version numbers always only go up).