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

Decide on mutability pattern for providers #5588

Open
JoshLove-msft opened this issue Jan 13, 2025 · 2 comments
Open

Decide on mutability pattern for providers #5588

JoshLove-msft opened this issue Jan 13, 2025 · 2 comments
Labels
emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp

Comments

@JoshLove-msft
Copy link
Contributor

Some properties can be updated via Update methods, whereas others have public setters. Prior to TypeSpec GA, we should decide on a pattern and implement it across the various provider types.

@JoshLove-msft JoshLove-msft added the emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp label Jan 13, 2025
@JoshLove-msft
Copy link
Contributor Author

Plan is to use setters. Anytime a customer invokes a setter is guaranteed to be after the protected Build method was called.

@JoshLove-msft
Copy link
Contributor Author

Chatted with @tg-msft, and the recommendation is to instead use Update methods as this gives us room for future optimizations in how we handle updates. It also fits with the paradigm that ASTs are immutable. We may want to return new instances from the Update method as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp
Projects
None yet
Development

No branches or pull requests

1 participant