Skip to content

Interpretations of variables with unusual names is ambiguous #144

@chrysaora-achlyos

Description

@chrysaora-achlyos

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions