Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If X at 0 is "a" behaves differently from Satriani #36

Open
hugobuddel opened this issue Dec 9, 2021 · 3 comments
Open

If X at 0 is "a" behaves differently from Satriani #36

hugobuddel opened this issue Dec 9, 2021 · 3 comments

Comments

@hugobuddel
Copy link
Contributor

The following program behaves differently in Rocky and in Satriani:

X is "abc"
Shatter X

If X at 0 is "a"
Say "True"
Else
Say "False"

Rocky gives True and Satriani gives False.

Switching the order (If "a" is X at 0) does result in True in both interpreters. (However, in my code I have at keywords at both sides of the equality.) I'll simply put the X at 0 in a variable first.

@hugobuddel
Copy link
Contributor Author

Real code that showed this bug: https://gitlab.astro.rug.nl/buddel/adventofcode/-/blob/master/2021/rockstar/day08/battle.rocks

This is a function I want to use in a larger program, put in a different file for debugging / future unit testing, copied into the main program.

Power is megalomical

Battle takes friends and foe
Let your castle be friends of power
Knock your castle down
Until your castle are weaker than nothing
The fight is true
Let evil be foe of power
Knock evil down
Until evil are less than nothing
If friends at your castle is foe at evil
The fight is gone

Knock evil down

If the fight isn't nowhere
Rock the empire with friends at your castle

Knock your castle down

Give the empire back


X is "abcd"
Y is "cb"
Say X
Say " minus"
Say Y
Say " is"
Shatter X
Shatter Y
Put battle taking X and Y into Z
Unite Z
Say Z

Rocky, which shows the desired behavior:

abcd
 minus
cb
 is
da

Satriani:

abcd
 minus
cb
 is
Wrong number of arguments supplied to function battle (friends,foe)

Oops (another bug?). Replacing the X and Y with X, Y, does not behave as intended:

abcd
 minus
cb
 is
dcba

@gaborsch
Copy link
Owner

Opened an issue in Rockstar for this, it's an operator precedence issue,
The second case you discovered is also similar, you could copy this code there, too.

But as I said, arrays are not yet 100% in Rocky (indexing will not change, though, only array comparison and the rock/roll operations),

@hugobuddel
Copy link
Contributor Author

Thanks, linking it here RockstarLang/rockstar#296

As for the second issue I'll just do , and

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants