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

Incorrect translation of properties #7

Open
Lexikos opened this issue Jun 21, 2021 · 0 comments
Open

Incorrect translation of properties #7

Lexikos opened this issue Jun 21, 2021 · 0 comments

Comments

@Lexikos
Copy link

Lexikos commented Jun 21, 2021

x := y.z  ; old
x := y["z"]  ; new (incorrect)

There is no single correct syntax translation for properties, since properties are the same as associative array elements in v1. But in general, .z is more likely to be a property than an associative array/map element. Even if the original code used the object like a map (i.e. it used both y.z and y["z"]), adding [] won't be enough since the object isn't a Map. A more direct (but not recommended) translation would be to instead replace y["z"] with y.%"z"%, as both y.z and y.%"z"% refer to the same thing in v2, just as y.z and y["z"] did in v1.

Best to just leave it as is, I think.

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

1 participant