beefytech / Beef

Beef Programming Language
http://www.beeflang.org
Other
2.51k stars 130 forks source link

Feature Request: Support implicit protected setter for get only properties #1986

Open jayrulez opened 6 months ago

jayrulez commented 6 months ago

The code below works in C#:

abstract class Parent
{
    public abstract int Number { get; }
}

class Child : Parent
{
    public override int Number { get; }

    public Child()
    {
        Number = 0;
    }
}

The code below does not compile in Beef:

abstract class Parent
{
    public abstract int Number { get; }
}

class Child : Parent
{
    public override int Number { get; }

    public this()
    {
        Number = 0;
    }
}

The Beef compiler complains that: Property has no setter

UserMist commented 1 month ago

I don't find it useful. Why wouldn't you specify a private setter? Having an exception to rules like that for constructors only is honestly a weird practice.