Empty List singleton

Issue #98 new
Jesper Öqvist created an issue

Click here to view original trac ticket.

Empty lists cost memory - the cost could be reduced by using a singleton empty list object. All empty lists would point to the singleton empty list, and a new list is created first when the list needs to be modified.

Comments (2)

  1. Jesper Öqvist reporter

    Some problems with this idea and why it may not be feasible to implement:

    • An empty list singleton would naturally have to occur in many places in the AST to be useful
    • If the singleton is in many places of the AST then the parent pointer can be considered incorrect for that node
    • Any inter-type declarations for the singleton should not be used to store information in the node, for example line number information. Such info becomes clobbered.
  2. Log in to comment