On Thu, 12 Apr 2007, Sven Schreiber wrote:
In general I must say I don't quite understand the need to have
both the @-escape *and* enclosing double quotes for a string
variable. Well I understand it after you've given the macro
explanation, but it certainly feels strange and in this
particular case will cause you headaches...
OK, I agree with you. On reflection, this is lame. (I have to
admit that the string variable code was thrown together too
hastily.)
I'm committing to CVS a change, whereby @foo-type string variables
are treated as proper variables in the relevant contexts, namely,
* when used as arguments to printf or sprintf, and
* when they appear on the right-hand side of
string sname = ...
This means that from now on you should _not_ enclose the names of
such variables in quotes in those contexts. Examples:
? printf "user dir is %s\n", @userdir
user dir is /home/allin/gretl
? string foo = @gretldir
Saved string as 'foo'
? print "@foo"
/opt/esl/share/gretl
? printf "%s\n", @foo
/opt/esl/share/gretl
? printf "%s\n", "@foo"
@foo
Allin.