What is {``} used for?

In all of my coding time, I have never ever used this. It throws a error in real simple case. So, how do you use it and why would it better than other approach?

It is used to force an expression to be considered as double-quoted.
Here is a typical use case. Imagine you have a string that potentially contains commas.
In G’MIC, a comma can be either :

  • A regular comma, that is ascii code 44. That’s actually the separator used when specifying command arguments.
  • A “string-encoded” comma, that has a different ascii code.

Sometimes, you want to specify a single command argument as a string that may contain regular commas. In this case, using {``$str} is the solution:

foo :
  400,400
  str="Hello, friends!"  # will work, comma is already considered as a string character
  str=Hello,\ friends # won't work, comma is a regular comma
  5,1,1,1,x str={^} # won't work, comma is a regular comma
  t $str,0.5~,0.5~,48,1,1  # won't work for the problematic cases
  t {``$str},0.5~,0.5~,48,1,1  # will always work
1 Like

Just to confirm @Reptorian. Are you talking about two backticks and not the double quotes in the title? Which code snippet piqued your curiosity?

@David_Tschumperle Thanks, I will see where I can use this.

@afre Backticks. I was reviewing the documentary, and this one pisque my interest.