|
From: Juergen W. <wie...@fr...> - 2005-06-07 21:16:35
|
> Currently the check for single- or double- quotes is made at > the time a string constant is parsed, as in: > A = "1\n2" > B = '1\n2' > if (A ne B) print "Strings are not equal" In my opinion, it should be this way. When I have to choose between single and double quotes, I take the ones which are more convenient in the current situation. I do not want to take into account what can happen to them later. Quite a few programming language offer both single and double quotes having different syntax (bash, perl, ...). But I'm not aware of a single one that keeps track wether a given string has been typed in this or that way. > But if you assign a value to a string variable via some more > complex path, including your new system() function, then there > is no check for whether embedded special characters should be > given the single-quote treatment (store raw input) or the > double-quote treatment (add \ in front of certain characters). It works the way I would want it to have. You can't input a newline character directly on the command line, so there has to be a way to get it into strings nevertheless. There is no such problem within pipes. If I need a newline in the string returned by system(), I'll use one. I don't see any need for escape sequences in this case. > As you can see from the sequence below, it does not > work to define and invoke a macro on the same input line: > > gnuplot> set macros > gnuplot> foo = "1"; print @foo; foo = "2"; print @foo > warning: foo is not a string variable > warning: foo is not a string variable > > gnuplot> foo = "1"; print ; foo = "2"; print > ^ > constant expression required I wouldn't really expect this to work. Juergen |