fut icon indicating copy to clipboard operation
fut copied to clipboard

syntactic sugar for getters/setters

Open iAndyHD3 opened this issue 1 year ago • 1 comments

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; }
}

iAndyHD3 avatar May 05 '24 11:05 iAndyHD3

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.

pfusik avatar May 07 '24 11:05 pfusik