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

Consider cloning for Repeated/MapField.Add(collection) #542

Closed
jskeet opened this issue Jun 25, 2015 · 1 comment
Closed

Consider cloning for Repeated/MapField.Add(collection) #542

jskeet opened this issue Jun 25, 2015 · 1 comment
Labels

Comments

@jskeet
Copy link
Contributor

jskeet commented Jun 25, 2015

Our Message(Message) constructors perform a deep clone. Perhaps we should do so when adding a collection, e.g.

var original = new Person
{
  Addresses = { new Address { Name = "original name" } }
};
var similar = new Person { Addresses = { original.Addresses } };
original.Addresses[0].Name = "new name";
Console.WriteLine(similar.Addresses[0].Name); // new name or original name?
@jskeet jskeet added the c# label Jun 25, 2015
@jskeet jskeet added this to the C# proto3 support milestone Jun 25, 2015
@jskeet
Copy link
Contributor Author

jskeet commented Aug 5, 2015

I'm pretty sure we don't want to do this - it would be surprising to most developers, as well as a performance hit. It's easy enough to call Clone if required.

@jskeet jskeet closed this as completed Aug 5, 2015
taoso pushed a commit to taoso/protobuf that referenced this issue Aug 1, 2018
Remove generate code dependencies on the order in which source files were
provided to the compiler. In other words, "protoc a.proto b.proto" produces
the same output as "protoc b.proto a.proto".

- Include the proto package version assertion in all files.

- Use the source file name and contents to generate unique var names for
  file descriptors, rather than the file index. In other words,
  "fileDescriptor_imp_81275c260ac30f8b" rather than "fileDescriptor0".

Makes the generated code more stable in the face of unrelated changes
(i.e., adding a new file to a package won't cause generated code for
other files in irrelevant ways), as well as trivial changes in the
protoc command line.

Removes the requirement that all files in a package be compiled at
the same time. Compiling each file individually will produce the same
results as compiling all at once.
adellahlou pushed a commit to adellahlou/protobuf that referenced this issue Apr 20, 2023
adellahlou pushed a commit to adellahlou/protobuf that referenced this issue Apr 20, 2023
rinarakaki pushed a commit to rinarakaki/protobuf that referenced this issue Aug 30, 2023
…e-conformance

Added conformance test variant to exercise dynamic minitable building
bithium pushed a commit to bithium/protobuf that referenced this issue Sep 4, 2023
…e-conformance

Added conformance test variant to exercise dynamic minitable building
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant