-
Notifications
You must be signed in to change notification settings - Fork 225
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
Inconsistent behaviour when accessing 2D arrays #356
Comments
OK, a quick recap of my thinking on this so far: what's the problem, why does it matter, and what constraints apply to any proposed solution: There are 1D arrays, "true" 2D arrays (matrices), and jagged arrays (arrays of arrays) In languages that support all three, you're talking about:
Rockstar doesn't have matrix arrays, but it does have jagged arrays. Now, imagine we've got an array like this:
In languages that use square-bracket arrays, the syntax is unambiguous:
Rockstar doesn't currently have any way to disambiguate this.
This means there is no way in Rockstar right now to write Like most things in Rockstar, you can work around the syntactic limitations if you're prepared to be verbose about it. You CAN do this:
or
However, there's definitely a need for a better syntax for indexed expressions, so I'm trying to come up with a Rockstar-style equivalent of the various possible permutations:
The syntax can't be anything that's valid inside an expression, so we can't reuse keywords like One idea was to use I'm going to keep tinkering with it but if anybody has any good ideas for an appropriate syntax, I'd love to hear them. |
array at 0 at 0
correctly parses toarray[0][0]
.However,
array at x at y
incorrectly parses toarray[x[y]]
.The text was updated successfully, but these errors were encountered: