Jellycuts-Issues icon indicating copy to clipboard operation
Jellycuts-Issues copied to clipboard

Interpretations of variables with unusual names is ambiguous

Open chrysaora-achlyos opened this issue 6 months ago • 0 comments

Describe the bug

Shortcuts allows for unusual variable names, say for instance the number "1", or what mistakenly be understood as expressions like "-varA" or "-(varA)". leading to some odd looking, and ambiguous code
import Shortcuts #Color: red, #Icon: shortcuts var 1="a" quicklook(input: 1) var varB=1 quicklook(input: varB)

line 4 compiles to valid shortcut and displays "a" Not sure on line 5 if varB should be assign the value of the variable named "1" (hence "a") or the number 1 line 5 compiles to valid shortcut and currently displays "1"

To Reproduce

Steps to reproduce the behavior:

  1. put the above code in Jellycuts
  2. Compile and load as a shortcut
  3. run shortcut
  4. See the first quicklook displays "a"
  5. See the second quicklook displays 1

Expected behavior

Shrug. not sure if second quicklook should display "a" or 1. The ambiguity is the issue.

Screenshots

If applicable, add screenshots to help explain your problem.

Information

  • Device: iPhone SE
  • OS: iOS 17.6.1
  • Jellycuts Version v2.3(0)
  • Jailbroken? No

Additional context

import Shortcuts #Color: red, #Icon: shortcuts var varA="a" quicklook(input: 1) var varB=-varA quicklook(input: varB) var varC=-(varA) compiles with out error, but does not run since a variable named "-varA" does not exist, and variable named "-(varA)" does not exist.
import Shortcuts #Color: red, #Icon: shortcuts var -(varA)="a" quicklook(input: -(varA)) strange as it may look, compiles and runs

potentially Jellycuts should restrict variable names to starting with only certain characters, even if it means being unable to express some code that does compile and run in shortcuts.

chrysaora-achlyos avatar Aug 22 '24 23:08 chrysaora-achlyos