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

Revising Observable Macro Comment for Struct Support in Swift #70026

Open
ojun9 opened this issue Nov 26, 2023 · 0 comments · May be fixed by #70190
Open

Revising Observable Macro Comment for Struct Support in Swift #70026

ojun9 opened this issue Nov 26, 2023 · 0 comments · May be fixed by #70190
Labels
feature A feature request or implementation triage needed This issue needs more specific labels

Comments

@ojun9
Copy link
Contributor

ojun9 commented Nov 26, 2023

Motivation

In the recently added Observation framework in Swift, the Observable macro is currently only applicable to classes and not structs. There is a comment in ObservableMacro.swift at line 212 stating// structs are not yet supported; copying/mutation semantics tbd. This comment might lead developers to expect that support for structs could be added in the future. However, discussions on the Swift forum (link here) indicate that monitoring structs in Swift presents challenges. Therefore, I believe it would be appropriate to remove the word "yet" from the comment to provide clearer information about the current scope of support.

Solution

A solution to this issue would be to revise the comment to more accurately reflect the current situation and future plans regarding support. For example, the comment could be rephrased to: structs are currently not supported due to copying/mutation semantics. Future support will depend on ongoing discussions and feasibility. Such a change would help ensure that developers do not have misconceptions about the current state of support and future direction.

Alternatives considered

An alternative approach to address this issue could be to add documentation explaining the technical challenges of supporting structs, based on discussions in the forum. This would provide developers with a deeper understanding of why structs are not currently supported at this time.

@ojun9 ojun9 added feature A feature request or implementation triage needed This issue needs more specific labels labels Nov 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A feature request or implementation triage needed This issue needs more specific labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant