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

Dot operator and Identifiers for Object properties. #28

Closed
4 tasks done
ballercat opened this issue Dec 15, 2017 · 3 comments · Fixed by #47
Closed
4 tasks done

Dot operator and Identifiers for Object properties. #28

ballercat opened this issue Dec 15, 2017 · 3 comments · Fixed by #47

Comments

@ballercat
Copy link
Owner

ballercat commented Dec 15, 2017

Goal

Improve consistency, make Walt object types appear more like structs(which they are).

Overview

Original issue (#22)

As of writing, object property access is performed via array subscript operator and string subscripts like so obj['foo']. This is not the ideal long-term solution and causes some confusion about the semantics of objects in Walt.

The long-term solution is to provide a new dot . binary operator which would be a single way to access properties on an object type.

Acceptance Criteria

  • The dot . operator which is not currently supported. We would need the tokenizer to recognize it (easy) and for the parser to convert it down to a plain old array subscript.
  • Unit tests
  • Removing/converting string property lookups, in examples and tests.
  • Identifiers as object definitions should work
@baransu
Copy link
Contributor

baransu commented Dec 26, 2017

Should we remove string property lookups at all from the language and do not handle them in tokenizer?

@ballercat
Copy link
Owner Author

No, not really, I do have plans for at least static strings, so I would like to keep string tokenizing around.

We should have one way of dealing with objects/structs. However, I don't think it needs to be all bundled under one PR either. It's totally fine to do this piece by piece, property lookups followed by object definitions, followed by a final cleanup of string property lookups.

@ballercat ballercat mentioned this issue Dec 27, 2017
4 tasks
@ballercat
Copy link
Owner Author

So it looks like due to my changes to the validation/generator steps Identifiers as object properties already work.

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

Successfully merging a pull request may close this issue.

2 participants