Pre-RFC: Partial Borrow Syntax Sugar

The syntax for anonymous structs is ambiguous and inconsistent, I would require the struct keyword before the { ... }.

This seems similar to views, so similar in fact that the only difference is that these views are anonymous. So I don't this as a Partial Borrow Syntax Pre-RFC, more as a Anonymous Structs Pre-RFC. This has been seen before. I don't see the value in this as it is trivial to come up with a name for a view struct. Also, if you need to use it in multiple places, you will have to name it anyways.

Secondly, are these field names leaked if the fields are private, but the function is public?

In fact Rust used to have a similar facility called structural records, but they were removed

1 Like