In Gekko, {}-curlies have been used for quite a long time now. The idea is that variable names can be composed by means of the {}-curlies, creating a means of composing names dynamically, in a sense forwarding from a string to a variable name corresponding to that string. For instance, if %s = ‘x’, the expression {%s} would refer to the variable name x, not the string ‘x’. In many computer languages, such name-composition is not possible, and the possibility of name-composition is one of the more popular features of Gekko (it should be mentioned that AREMOS, EViews and others implement this feature, too).

In Gekko 2.x, the use of {}-curlies had become a bit fuzzy, since they could sometimes be omitted, and sometimes not. In addition, Gekko 2.x contained the monstrosity of the distinction between strings and names, originally inspired by the AREMOS distinction between strings and literals. This monstrosity (= the name type in Gekko 2.x) has been eradicated in Gekko 3.0, and hence whenever a string is supposed to be used as a name, the user must always enclose the string inside {}-curlies, no exceptions. Therefore, if %s = ‘x’, a statement like PRT %s will just print the string ‘x’ on the screen, whereas a statement like PRT {%s} will look for the variable x (a timeseries), and print that timeseries on the screen.

In principle, with a string inside a {}-curly, the logic is straightforward. The {}-curly performs a forwarding operation, looking for the variable corresponding to the string inside the {}-curly. So for instance, if %s = ‘x’, the statement PRT {%s} is exactly the same as PRT x. Now we can try inserting: PRT {%s} becomes PRT {‘x’}, which becomes PRT x, from which it is seen that the {}-curlies are in a sense quote-eaters, transforming {‘x’} into just x. This is a bit of a limited way of looking at {}-curlies, but there is some truth to that interpretation. This is also seen regarding name-composition, for instance the name a{%s}b, where a similar logic can be applied: a{%s}b becomes a{‘x’}b, which becomes axb, and again: the curlies have eaten a pair of quotes.

This also means that {}-curlies with a string inside can be understood as simply a sequence of characters (without quotes), just as if {…} had been the name abc. This leads us to the so-called abc-test. If in a particular command it is natural to use the name abc, then you should also use for instance {%s}, whereas if it is natural to use the string ‘abc’, you should use omit curlies and just use the raw string, %s.

Beware though that the {}-logic is not quite that simple when it comes to lists of strings. In order to use {}-curlies, the inside of such a curly must evaluate to a string or to a list of strings (actually integer values are also allowed, but let us think of them as strings). We have already covered the case where the inside of the {}-curly is a string, so let us move on to the list case. Consider the list #m = (‘x’, ‘y’), or defined with a naked list as “#m = x, y;”. If we issue a “PRT #m;”, we will just get the strings ‘x’ and ‘y’ printed on the screen, whereas “PRT {#m};” prints the variables x and y (two timeseries), just like the statement “PRT x, y;”. There is more to it though, because you may combine a list with fixed parts, as for instance “PRT a{#m}b;”, which is the same as “PRT axb, ayb;”. You may even use several lists inside one name (like for instance a{#m1}b{#m2}c: in that case, the lists are combined, so if #m1 has n1 elements, and #m2 has n2 elements, the resulting print will show n1·n2 variables.

So to sum up: if the inside of a {}-curly is a string, the {}-curly returns the characters of that string (without quotes), possibly glueing them together with other name parts. The result of this will be a variable name. If the inside of a {}-curly is a list of strings, Gekko will also use the characters of these string elements (without quotes), and possibly glueing these together with other name parts. The result of this will be a list of variable names.

Image note: the image depicts a so-called Tuborg hat, used on trucks delivering Tuborg beer. In Danish, {}-curlies are often called “tuborg” because of the similar shape.