nyan icon indicating copy to clipboard operation
nyan copied to clipboard

Prefix nyan object declarations with keyword `obj`

Open heinezen opened this issue 2 years ago • 0 comments

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 avatar May 23 '22 19:05 heinezen