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

Subcommands #463

Open
nickheyer opened this issue Nov 13, 2024 · 2 comments
Open

Subcommands #463

nickheyer opened this issue Nov 13, 2024 · 2 comments
Assignees

Comments

@nickheyer
Copy link
Contributor

Feature Description

I know that one command per line is a core principle of the language, but after considering it on and off for months, I think it would be worth exploring even with a scoped subset of commands.

Describe The Solution You'd Like

After becoming pretty familiar with the src, it's clear why one command per line is the way to go, it makes things pretty easy to parse and keeps them orderly in terms of execution. That being said, recursively parsing instructions with look backs shouldn't add too much complexity.

Open to suggestions.

@sagiegurari
Copy link
Owner

there are few examples that it is not the case. for example 'set' knows to invoke a function and so does 'if'.
so it is in the command logic itself.
the general concept was to keep everything super simple and if needed for specific command, do it there.

what did you have in mind?

@nickheyer
Copy link
Contributor Author

nickheyer commented Dec 4, 2024

@sagiegurari I remembered reading this suggestion a while back when I first discovered duck script.

Now after really diving into the language, it makes a lot of sense re-reading the proposed design.
Here is a use case example:

ind = set 1
len = array_length $( glob_array ./${ind}/*.foo )
echo "${ind} foo file count:  ${len}"

Could be expanded to:

ind = set 1

__var_1 = glob_array ./${ind}/*.foo

len = array_length ${__var_1}

echo "${ind} foo file count:  ${len}"

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

2 participants