Skip to content

Use # field operator for private fields #32

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

Merged
merged 2 commits into from
Mar 10, 2025
Merged

Use # field operator for private fields #32

merged 2 commits into from
Mar 10, 2025

Conversation

Corniel
Copy link
Contributor

@Corniel Corniel commented Mar 10, 2025

In general I'm not sure if I would like to use the # field operator, but hiding the underlying field for string based SVO's is key. So also making them private in the ECMAScript (runtime) context, rather then only within the TypeScript (design-time) context makes sense.

See microsoft/TypeScript#31670

@Corniel Corniel added the enhancement New feature or request label Mar 10, 2025
@Corniel Corniel self-assigned this Mar 10, 2025
@Jognt
Copy link

Jognt commented Mar 10, 2025

If you absolutely want to disallow code to touch a variable, then using the # syntax makes sense.

Performance-wise it shouldn't be too big of a difference according to this response

What other reasoning would you have to use one over the other?

@Corniel
Copy link
Contributor Author

Corniel commented Mar 10, 2025

If you absolutely want to disallow code to touch a variable, then using the # syntax makes sense.

Performance-wise it shouldn't be too big of a difference according to this response

What other reasoning would you have to use one over the other?

Thanks for the research. Let's go for it. If we face issues along the way, we can always reverse things.

@Corniel Corniel merged commit 81ddf88 into main Mar 10, 2025
1 check passed
@Corniel Corniel deleted the private branch March 10, 2025 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants