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

value representation for structs and tuples #3297

Open
zygoloid opened this issue Oct 13, 2023 · 1 comment
Open

value representation for structs and tuples #3297

zygoloid opened this issue Oct 13, 2023 · 1 comment
Labels
leads question A question for the leads team

Comments

@zygoloid
Copy link
Contributor

zygoloid commented Oct 13, 2023

Summary of issue:

From this review comment:

What should the value representation for a struct or tuple be? Some options:

  • A by-copy struct or tuple of the value representations of the elements. (This is presumably the right answer when the struct or tuple is small, such as when it has a single element.)
  • A by-pointer struct or tuple of the value representations of the elements. (This is option 1a in the review comment, and what the toolchain currently does for multi-element structs and tuples.)
  • A by-pointer struct or tuple of the value representations of the elements, except that by-pointer elements are flattened to by-copy elements. (This is option 1b.)
  • A by-pointer object representation of the struct or tuple. (This is option 2.)

Details:

All of the options have downsides -- see the review comment thread. Selecting between them based on criteria such as the size of the elements may be the best choice.

Any other information that you want to share?

No response

@zygoloid
Copy link
Contributor Author

It's worth noting that this choice is influenced strongly by Carbon's goal of predictable performance. If we come up with criteria by which we switch between strategies, we will presumably want to provide some way of controlling the decision or at least clear rules by which it can be understood.

zygoloid added a commit to zygoloid/carbon-lang that referenced this issue May 1, 2024
Change the syntax for `package` declarations from:

```carbon
[package Foo] [library "bar"] api;
[package Foo] [library "bar"] impl;
```

to

```carbon
[package Foo] [library "bar"];
impl [package Foo] [library "bar"];
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
leads question A question for the leads team
Projects
None yet
Development

No branches or pull requests

1 participant