Skip to content

Formatting large objects #2095

@codehag

Description

@codehag

This isn't a bug, its a formatting question/request. (cc @ljharb)
I am currently reading https://tc39.es/ecma262/#sec-parsemodule and the last instruction here returns a complex object with a number of fields. It looks like this in the text:

12. Return Source Text Module Record { [[Realm]]: realm, [[Environment]]: undefined, [[Namespace]]:
     undefined, [[Status]]: unlinked, [[EvaluationError]]: undefined, [[HostDefined]]: hostDefined, 
     [[ECMAScriptCode]]: body, [[Context]]: empty, [[ImportMeta]]: empty, [[RequestedModules]]: 
     requestedModules, [[ImportEntries]]: importEntries, [[LocalExportEntries]]: localExportEntries, 
     [[IndirectExportEntries]]: indirectExportEntries, [[StarExportEntries]]: starExportEntries, [[DFSIndex]]: 
     undefined, [[DFSAncestorIndex]]: undefined }.

I imagin this has been discussed in the past. Are there ideas of how to make this easier to read? For example:

12. Return Source Text Module Record { 
  [[Realm]]: realm, 
  [[Environment]]: undefined, 
  [[Namespace]]: undefined, 
  [[Status]]: unlinked, 
  [[EvaluationError]]: undefined, 
  [[HostDefined]]: hostDefined, 
  [[ECMAScriptCode]]: body, 
  [[Context]]: empty, 
  [[ImportMeta]]: empty, 
  [[RequestedModules]]: requestedModules, 
  [[ImportEntries]]: importEntries, 
  [[LocalExportEntries]]: localExportEntries, 
  [[IndirectExportEntries]]: indirectExportEntries, 
  [[StarExportEntries]]: starExportEntries, 
  [[DFSIndex]]: undefined, 
  [[DFSAncestorIndex]]: undefined 
}.

It takes up a lot more space, but it is also much easier to see what is going on.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions