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"
No
No
@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)
Looks like we don’t need it to disambiguate. BUT this complicates resolution.
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.
Yes, this is a 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
No
No. But we list “instantiated” goals instead.
Based on goal name only. I.e. disallow depending PG on itself in any way.
Only:
- what’s in
@define
(not now, maybe in future) - any VAR in
@params
of this goal - All other cases must cause error.
Also here. Need to adjust -d
option. Should list instantiated goals in form
pg1@hello
$'pg2@hello@with \''
nonpg
- Build tree no-params : detect loops
- Build tree non-instantiated
- Instantiate. How?
- On encounter
@depends_on
generate instantiated. This needs to go in-depth.
- On encounter
Disallow
Instantiated goals will be private
Should work as expected. PG vars should be accessible in lib code.
Should work as expected. PG vars should be accessible in @reached_if
code.
Should work as expected. @doc
should just copy to instantiated goals.