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

Resolved issue #326, supported command line arguments, added example program #336

Merged
merged 9 commits into from
Sep 16, 2019

Conversation

open-journal
Copy link

Resolved issue #326, supported command line arguments, added example Wyvern program that demonstrates the usage of command line arguments.

sychoo added 3 commits July 9, 2019 22:46
…d example Wyvern program that demonstrate the usage of command line argument
…module cmdArgs under java platform. Updated example file examples/CommandLineArguments.wyv
Copy link
Member

@JonathanAldrich JonathanAldrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good functionality but could you address the issues I brought up before merge?

@@ -65,6 +65,7 @@ private Globals() { }
javaWhiteList.add("wyvern.stdlib.support.Sys.utils");
javaWhiteList.add("wyvern.stdlib.support.HashMapWrapper.hashmapwrapper");
javaWhiteList.add("wyvern.stdlib.support.ArrayWrapper.arr");
javaWhiteList.add("wyvern.stdlib.support.CommandLineUtils.utils");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this should not be on the javaWhiteList - using command line arguments is something that is potentially dangerous and not every module should be able to do it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just undo this edit?

examples/commandLineArguments.wyv Show resolved Hide resolved
private CommandLineUtils() {
}

public CommandLineUtils(String[] arguments) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This design--where there are two constructors, and this one is used only for its side effect on global variables--is hard to understand. It would be better to omit this constructor and instead just call convertToDynArrayList() from the interpreter's main function, passing the arguments.

return arguments.length;
}

private void convertToDynArrayList() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably shouldn't be named starting with "convert" - better to start with "set" since the main thing this function does is side-effect the global variable to hold the arguments.

…itted the CommandLineUtils constructors that accepts arguments, renamed convertToDynArrayList() function to setArgumentList().
…java, Omitted the CommandLineUtils constructors that accepts arguments, renamed convertToDynArrayList() function to setArgumentList()."

This reverts commit 47c9004.
…itted the CommandLineUtils constructors that accepts arguments, renamed convertToDynArrayList() function to setArgumentList().
@JonathanAldrich
Copy link
Member

Looks good, thanks for the edits!

@JonathanAldrich JonathanAldrich merged commit 0fa29bf into wyvernlang:master Sep 16, 2019
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

Successfully merging this pull request may close these issues.

3 participants