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

Prefix nyan object declarations with keyword obj #98

Open
heinezen opened this issue May 23, 2022 · 0 comments
Open

Prefix nyan object declarations with keyword obj #98

heinezen opened this issue May 23, 2022 · 0 comments
Labels
improvement improves existing functionality proposal pending discussion about something to do specification involves the nyan language specification

Comments

@heinezen
Copy link
Member

heinezen commented May 23, 2022

Currently, nyan object declarations start with the object name followed by parent and member definitions. The parser expects no specific keyword that identifies an object. Instead, the parser assumes that all non-keyword tokens start an object declaration. This also makes the parser rely on an implicit order of definitions in the file (file parameter -> imports -> objects).

# Current implementation
ExampleObject(Parent):
    member_a : int = 5

Proposed changes:

  • All object declarations must start with obj
  • obj becomes a keyword
# Proposed implementation
obj ExampleObject(Parent):
    member_a : int = 5

Advantages:

  • Makes it easier to introduce new data structures (if necessary)
  • Definitions of objects, parameters and imports can be read in any order
@heinezen heinezen added improvement improves existing functionality specification involves the nyan language specification proposal pending discussion about something to do labels May 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement improves existing functionality proposal pending discussion about something to do specification involves the nyan language specification
Projects
None yet
Development

No branches or pull requests

1 participant