Should the char '@' and '-' be allowed to used for variables and command names?

At the moment, @ is treated as if it were a file name, but to my knowledge, no one use @ as part of file names. And, I don’t think there’s a harm to adding the option to use @.

So far, for variable names, only numbers, alphabets, and underscore is allowed. I don’t see other being allowed.

In addition, - char seems redundant when used next to command names. In every of my code and most other codes that I see in gmic-community. No one really use - char next to command names. I’d argue this can be safely used as valid character to use for variable names. If you don’t want to have to use underscore because it is global, and you want to use something else, if - were allowed, you’d use this instead.

That sounds like a strange idea to me.
What would be the use case ? What is the need for that ?

Most programming languages does not allow the use of exotic characters in variable or function names.
Concerning G’MIC : Allowing this would greatly complexify the code parsing done by the G’MIC interpreter, because lot of ambiguous expressions could potentially happen. I’m not sure that making the code interpreter slower just to allow that worths it.

-1 on the dash/minus as part of variable names. makes reading code more complex also for the human.

foo-bar is this a variable or substracting foo from bar?

for the @ part: it is a valid character in filenames and e.g. i saw people using it when e.g. saving files from emails - which then pull in the sender email into the filename. I havent run into any programming language that allowed it in identifiers either.

as a general note: readability is important. and most programming languages have very similar rules for identifier as gmic. which makes it also a lot easier for people to get into other languages - including gmic.

being able to use things like ꟛ ⅀ ∏ in your gmic scripts, that might be something useful :slight_smile:

Well, I was thinking of dodging the use of _ for this.

_0:='0'
e $_0

For me to avoid doing that, I do this:

n0:='0'
e $n0

On the -, ok never mind on that. I realized about the math aspect, but I was so focused on the redundancy of -command syntax that I literally forgotten that. And _0 looks beautiful, but it creates a global, which I generally avoid.

Oh, that is a good use case I haven’t heard of.

Which brings me to a question, what about one of the exotic currency symbol? They look ugly though. The least bad is ¥. But, nah.

Those are not actually currency symbols but the mathematical symbols for each operation. ⅀ == sum, ∏ == product, ꟛ lambda.

there was a ruby gem in the past that added aliases for those so you can use the ꟛ instead of lambda in your code :smiley: