Skip to content
This repository has been archived by the owner on Jun 27, 2022. It is now read-only.

[Lang Enhancement Proposal] @overload decorator for allowing function signature overloads #34

Open
Tracked by #33
Luna-Klatzer opened this issue Jul 25, 2021 · 0 comments
Assignees
Labels
enhancement New feature or request idea Theoretical feature, idea etc. language Core language issue, change or idea

Comments

@Luna-Klatzer
Copy link
Member

Luna-Klatzer commented Jul 25, 2021

Affected area by change:

  • Language Syntax: yes
  • Language Library (Parac Base Library): no
  • Compiler: yes
  • Pre-Processor: no
  • Documentation: yes

Short Introduction and Summary
The addition of the compiler-managed @overload decorator, which would allow for specific signatures to be automatically used depending on the input. This decorator will be only important to the Para-C Compiler, which would correctly assemble the functions and create the C code.

Is your request related to a problem? Please describe.
Ability to write nicer functions, especially considering the difference between arrays and singular values, which could then be written in overloads and managed by separate functions, but easily used since the same identifier can be used.

Describe the solution you'd like
Implementation of a decorator called overload with an implementation look possibly similar to this:

@overload
type identifier(int x)
{
    return identifier((float) x); // Should also include the ability to call inside one overload other overloads
}

type identifier(float y)
{
    ...
}

Describe alternatives you've considered
Possibly allowing for direct overloading without any decorator, like in C#, which would make the previous code look like this:

type identifier(int x)
{
    return identifier((float) x);
}

type identifier(float y)
{
    ...
}
@Luna-Klatzer Luna-Klatzer added enhancement New feature or request idea Theoretical feature, idea etc. labels Jul 25, 2021
@Luna-Klatzer Luna-Klatzer self-assigned this Jul 25, 2021
@Luna-Klatzer Luna-Klatzer added the language Core language issue, change or idea label Apr 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request idea Theoretical feature, idea etc. language Core language issue, change or idea
Projects
None yet
Development

No branches or pull requests

1 participant