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

added args() function #300

Merged
merged 3 commits into from
Nov 16, 2019
Merged

added args() function #300

merged 3 commits into from
Nov 16, 2019

Conversation

sysread
Copy link
Contributor

@sysread sysread commented Nov 7, 2019

Adds a new abs function, args(), that returns the number of arguments to the current script, including
the script itself. This is useful for scripts which accept a variable number of positional arguments (for example, a list of files).

Copy link
Collaborator

@odino odino left a comment

Choose a reason for hiding this comment

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

Amazing! Would you mind adding a test for the function?

@sysread
Copy link
Contributor Author

sysread commented Nov 7, 2019

I'd be happy to. Do you mean a go test (I wasn't certain where those would go - evaluator/evaluator_test.go?) or a abs test in tests?

@odino
Copy link
Collaborator

odino commented Nov 9, 2019

In the evaluator package :) You can see similar tests here! cheers!

Jeff Ober added 2 commits November 11, 2019 09:34
Returns the number of arguments to the current script, including
the script itself.
@sysread
Copy link
Contributor Author

sysread commented Nov 11, 2019

I've added the test and rebased the branch in my fork.

@odino
Copy link
Collaborator

odino commented Nov 13, 2019

I've been thinking about the semantics of the args function a bit and I believe it might be better to have it return a list of arguments. When you call args() you'd probably expect the arguments, not their length, back. One can still figure out what is the length with args().len(). What do you think?

@sysread
Copy link
Contributor Author

sysread commented Nov 14, 2019

Updated.

Copy link
Collaborator

@odino odino left a comment

Choose a reason for hiding this comment

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

Nice!

@odino odino merged commit f201070 into abs-lang:1.8.x Nov 16, 2019
@odino
Copy link
Collaborator

odino commented Nov 16, 2019

This is about to be released. I've made an exception and included it as 1.8.3 though next time we add a feature it should go in the next minor release (1.9.x at this point in time). Regardless, thanks a bunch!

@odino
Copy link
Collaborator

odino commented Nov 16, 2019

It's released, have fun 😄

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.

None yet

2 participants