Skip to content

default get / default set for properties #11434

Description

@kLabz

While we might add HaxeFoundation/haxe-evolution#96 in 5.0 (?), current property syntax could be enhanced with a new modifier which would be equivalent to public var propertyWithField:T { get; set; }:

public var propertyWithField(default get, default set):T;

This would be equivalent to:

@:isVar
public var propertyWithField(get, set):T;
function get_propertyWithField():T return propertyWithField;
function set_propertyWithField(val:T):T return propertyWithField = val;

Which allows child classes to override getter/setter.


Also while we're at it, maybe init like in C# would be a nice addition now that we have final fields with similar behavior 🤔

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions