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

Parameterized goals #115

Closed
xonixx opened this issue Dec 8, 2022 · 0 comments
Closed

Parameterized goals #115

xonixx opened this issue Dec 8, 2022 · 0 comments
Assignees
Labels
Milestone

Comments

@xonixx
Copy link
Owner

xonixx commented Dec 8, 2022

Parameterized goals

The idea for this is inspired by #112.
This should be much better and more generic alternative to #96.

This should allow such rewrite.

Related to this. Obviously this is being revised.

@goal files_created @params A B
@depends_on file_created @args $A
@depends_on file_created @args $B
@depends_on file_created @args '/tmp/file'
@depends_on goal_3_args @args $A '/tmp/file' $B

@goal file_created @params F
@reached_if [[ -f "$F" ]]
  echo hello > "$F"

Q. Default values.

No

Q. Optional values.

No

Q. How to pass var argument?

  • @VAR
  • Cons: non-uniform syntax
  • Using this form can help getting rid of @args and allow mixing dependencies
  • But this needs to disambiguate the case when goal is named @name
  • But not that simple… what about literal values?
  • "${VAR}" but only this form, not "aaa${VAR} bbb"
  • VAR, literal values must be quoted (with single quotes or dollar-single quotes to disallow substitutions)

Q. Do we even need keyword @args?

Looks like we don’t need it to disambiguate. BUT this complicates resolution.

Q. Do we need keyword @params?

Looks like yes

  • for consistency
  • for ease of parsing

Q. Do we allow to include parameterized goal in @depends_on together with other goals? Or only single?

No. @args will be only allowed in pos=3. All items afterwards are considered args.

Q. Shall we restrict the param name to Name123? [A-Z][A-Za-z0-9_]*

This might be good idea / convention.

Q. Can we make parameterized goals resolution during parsing? We might need to know the number of params for a goal which is not available yet, since goal may come later.

Looks like this is only possible if we restrict the syntax to

@depends_on param_goal @args 'hello'

I.e. when @args is at pos=3

@depends_on param_goal ( 'hello' A 'world' ) # needs more parsing

Q. Allow calling parameterized goal from CLI?

No

Q. Allow listing PG?

No.
What about “instantiated” goals?

Q. Loops detection.

Based on goal name only? I.e. disallow depending PG on itself in any way.

Q. What can be @args VAR?

Only:

  • what’s in @define
  • any VAR in @params of this goal
    All other cases must cause error.

Q. Mechanism for "instantiation"

Also here. Need to adjust -d option. Should list instantiated goals in form

  • pg1 @args 'hello'
  • pg2 @args 'hello' $'with \''
  • nonpg
  1. Build tree no-params : detect loops
  2. Build tree non-instantiated
  3. Instantiate. How?

On encounter @depends_on generate instantiated? But this needs to go in-depth.

@xonixx xonixx added the idea label Dec 8, 2022
@xonixx xonixx self-assigned this Dec 8, 2022
xonixx added a commit that referenced this issue Jan 18, 2023
xonixx added a commit that referenced this issue Jan 19, 2023
xonixx added a commit that referenced this issue Jan 19, 2023
xonixx added a commit that referenced this issue Jan 19, 2023
xonixx added a commit that referenced this issue Jan 19, 2023
xonixx added a commit that referenced this issue Jan 19, 2023
xonixx added a commit that referenced this issue Jan 19, 2023
xonixx added a commit that referenced this issue Jan 19, 2023
xonixx added a commit that referenced this issue Jan 19, 2023
xonixx added a commit that referenced this issue Jan 20, 2023
xonixx added a commit that referenced this issue Jan 20, 2023
xonixx added a commit that referenced this issue Jan 20, 2023
xonixx added a commit that referenced this issue Jan 20, 2023
xonixx added a commit that referenced this issue Jan 20, 2023
xonixx added a commit that referenced this issue Jan 20, 2023
xonixx added a commit that referenced this issue Jan 20, 2023
xonixx added a commit that referenced this issue Jan 20, 2023
xonixx added a commit that referenced this issue Jan 20, 2023
xonixx added a commit that referenced this issue Jan 20, 2023
xonixx added a commit that referenced this issue Jan 21, 2023
xonixx added a commit that referenced this issue Jan 21, 2023
@xonixx xonixx added this to the PLANNED milestone Jan 21, 2023
xonixx added a commit that referenced this issue Jan 21, 2023
xonixx added a commit that referenced this issue Jan 22, 2023
xonixx added a commit that referenced this issue Jan 22, 2023
xonixx added a commit that referenced this issue Jan 23, 2023
xonixx added a commit that referenced this issue Jan 23, 2023
xonixx added a commit that referenced this issue Jan 23, 2023
xonixx added a commit that referenced this issue Jan 24, 2023
xonixx added a commit that referenced this issue Jan 25, 2023
xonixx added a commit that referenced this issue Jan 25, 2023
xonixx added a commit that referenced this issue Jan 26, 2023
xonixx added a commit that referenced this issue Jan 26, 2023
xonixx added a commit that referenced this issue Jan 26, 2023
xonixx added a commit that referenced this issue Jan 26, 2023
xonixx added a commit that referenced this issue Jan 26, 2023
xonixx added a commit that referenced this issue Jan 26, 2023
xonixx added a commit that referenced this issue Jan 26, 2023
xonixx added a commit that referenced this issue Jan 26, 2023
xonixx added a commit that referenced this issue Jan 26, 2023
@xonixx xonixx modified the milestones: PLANNED, 0.9.20 Feb 14, 2023
xonixx added a commit that referenced this issue Feb 14, 2023
xonixx added a commit that referenced this issue Feb 14, 2023
xonixx added a commit that referenced this issue Feb 14, 2023
xonixx added a commit that referenced this issue Feb 14, 2023
@xonixx xonixx closed this as completed Feb 14, 2023
xonixx added a commit that referenced this issue Feb 14, 2023
xonixx added a commit that referenced this issue Mar 2, 2023
xonixx added a commit that referenced this issue Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant