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

Extend instantiate api #5

Open
Nuckerr opened this issue May 12, 2023 · 4 comments
Open

Extend instantiate api #5

Nuckerr opened this issue May 12, 2023 · 4 comments
Assignees

Comments

@Nuckerr
Copy link
Contributor

Nuckerr commented May 12, 2023

Right now, instantiate is limited to methods. This doesn't work very well in kotling, as functions are not used in the same way they are in java. I think some possible additions to allow for different ways of using the API are:

  • Be able to annotate variables with the annotation and have that work
  • Expose a function from the api to inject variables, bypassing the instantiate annotation entirely.
@sttephen
Copy link

Agree with both.

@joshbker
Copy link
Member

Completely agree with the first one, could you give a use-case/example of the latter as struggling to quite grasp what you mean, thanks

@joshbker
Copy link
Member

First part is closed by 3f1bd4a

@Nuckerr
Copy link
Contributor Author

Nuckerr commented May 18, 2023

Completely agree with the first one, could you give a use-case/example of the latter as struggling to quite grasp what you mean, thanks

Right now, the variables being added to the map are hidden in one massive method. Instead, put it in its own method that can be accessed. Then, a developer could, for example:

public static void main() {
    Neptune.instantiate(new PlayerManager());
}

Bypassing annotations if they so please.
(Ignore my bad code, am on mobile)

@joshbker joshbker self-assigned this Jun 25, 2023
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

3 participants