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

Special-case empty { ... } sequences for prettier name mangling. #104

Closed

Commits on Sep 12, 2022

  1. Special-case empty { ... } sequences for prettier name mangling.

    With the current mangling for eg. records:
    
    ```python
      return 'record { ' + ', '.join(mangled_fields) + ' }'
    ```
    
    the mangling for a record with 0 fields is `record {  }`, with two
    spaces between the braces. That looks subjectively surprising.
    
    This PR adds special cases to the mangling for `record` and similar
    types so that the mangling is `record {}`, with no spaces between the
    braces, which is subjectively prettier.
    
    The argument against this is that empty records should be very rare,
    so prettiness isn't important, and every special case makes the system
    more complex. The argument for it is that a mangling with two spaces
    looks weird.
    sunfishcode committed Sep 12, 2022
    Configuration menu
    Copy the full SHA
    8479549 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4fd13dd View commit details
    Browse the repository at this point in the history