-
Notifications
You must be signed in to change notification settings - Fork 783
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
Java define return types #1277
base: main
Are you sure you want to change the base?
Java define return types #1277
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Just realized that this breaks every language that uses the code_functions tag that isn't Java. Will update if I come up with another solution. |
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
I have finished testing this and it looks like it works well. Some final thoughts: There are two main ways I thought of doing this. The first way is the way that I did it in my first commit which involved changing all the code_* functions in functions.py to allow them to accept return values as arguments and the way that I did it in my last commit where the correct function is chosen based on whether the user dictates a return type or not. Both ways have pros and cons. I also wanted to add that even though I only did these changes for Java, the same thing could be done for other languages as well. Any feedback is appreciated! |
Added ability to define return types in Java more easily when creating a function. Previously, the return types would always default to void. Now, you can (optionally) decide to specify the return type of a function during creation. The previous way of defining functions still works too.
Example: saying "pub static String funky my function" will return
public static String myFunction()
This works for all of the code types defined in java.py