Skip to content

syntactic sugar for getters/setters #159

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

Open
iAndyHD3 opened this issue May 5, 2024 · 1 comment
Open

syntactic sugar for getters/setters #159

iAndyHD3 opened this issue May 5, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@iAndyHD3
Copy link
Contributor

iAndyHD3 commented May 5, 2024

since public fields are not allowed, this means one is forced to write setters and getters for every single member. Doing so is a lot of work, especially with structures with many fields.

Suggestion:
syntactig sugar for getters/setters, perhaps something similar to c#?

public class Person
{
    public string Name { get; set; }
    public int Age { get; set; }
}
@pfusik pfusik added the enhancement New feature or request label May 7, 2024
@pfusik
Copy link
Collaborator

pfusik commented May 7, 2024

What do you mean by "a lot of work" ? If it's a few dozen fields, it's a one-time investment of a few minutes.

I consider introducing C#-style properties to Fusion. The goal is not to reduce how much you type, but ability to emit code that feels natural to the target language. And especially for C# you'd want properties.

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

No branches or pull requests

2 participants