Skip to content
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

[Enhancement] Support method overloading #74

Open
thargy opened this issue May 19, 2018 · 0 comments
Open

[Enhancement] Support method overloading #74

thargy opened this issue May 19, 2018 · 0 comments

Comments

@thargy
Copy link
Contributor

thargy commented May 19, 2018

Currently, method overloading doesn't work. To support, method numbering would help, e.g. (extending the example in #73):

    public struct SimpleConstructedStruct
    {
        public readonly float OutFloat;

        public SimpleConstructedStruct(float outFloat)
        {
            OutFloat = outFloat;
        }

        public SimpleConstructedStruct Increment()
        {
            return new SimpleConstructedStruct (OutFloat + 1.0f);
        }

        public SimpleConstructedStruct Increment(float amount)
        {
            return new SimpleConstructedStruct (OutFloat + amount);
        }
    }

...
    SimpleConstructedStruct s = new SimpleConstructedStruct(1.0f);
    s = s.SimpleConstructedStruct();
    s = s.SimpleConstructedStruct(1.0f);

Should be written as:

    struct SimpleConstructedStruct
    {
        float OutFloat;
    };

    SimpleConstructedStruct_0_ctor(float outFloat)
    {
        SimpleConsructedStruct this;
        this.OutFloat = outFloat;
        return this;
    }

    SimpleConstructedStruct_Increment(SimpleConstructedStruct this)
    {
        return SimpleConstructedStruct_0_ctor(this.OutFloat + 1.0);
    }

    SimpleConstructedStruct_Increment_2(SimpleConstructedStruct this, float amount)
    {
        return SimpleConstructedStruct_0_ctor(this.OutFloat + amount);
    }

...
    SimpleConstructedStruct s = SimpleConstructedStruct_0_ctor(1.0);
    s = SimpleConstructedStruct_Increment(s);
    s = SimpleConstructedStruct_Increment_2(s, 1.0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant